package nz.jimmy.easyspawn; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.configuration.Configuration; import org.bukkit.entity.Player; /** * Spawn */ public class Spawn implements CommandExecutor{ private EasySpawn plugin; public Spawn(EasySpawn plugin) { this.plugin = plugin; plugin.getCommand("spawn").setExecutor(this);; } public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if(sender instanceof Player) { Player player = (Player)sender; Configuration config = plugin.getConfig(); World world = player.getWorld(); String w = world.getName(); if(config.contains("spawn."+w)){ Location location = new Location(world, config.getInt("spawn."+w+".x"), config.getInt("spawn."+w+".y"),config.getInt("spawn."+w+".z"), config.getInt("spawn."+w+".pitch"), config.getInt("spawn."+w+".yaw")); player.teleport(location); player.sendMessage("You have been teleported to spawn."); }else player.sendMessage("This world has no spawn"); return true; } return false; } }