38 lines
1.3 KiB
Java
38 lines
1.3 KiB
Java
package nz.jimmy.easyspawn;
|
|
|
|
import org.bukkit.Location;
|
|
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;
|
|
|
|
/**
|
|
* SetSpawn
|
|
*/
|
|
public class SetSpawn implements CommandExecutor{
|
|
EasySpawn plugin;
|
|
public SetSpawn(EasySpawn plugin) {
|
|
this.plugin = plugin;
|
|
plugin.getCommand("setspawn").setExecutor(this);
|
|
}
|
|
|
|
public boolean onCommand(CommandSender sender, Command cmd, String label,
|
|
String[] args) {
|
|
if( sender instanceof Player) {
|
|
Player player = (Player)sender;
|
|
Location location = player.getLocation();
|
|
String world = player.getWorld().getName();
|
|
Configuration config = plugin.getConfig();
|
|
config.set("spawn."+world+".x", location.getBlockX());
|
|
config.set("spawn."+world+".y", location.getBlockY());
|
|
config.set("spawn."+world+".z", location.getBlockZ());
|
|
config.set("spawn."+world+".pitch", location.getPitch());
|
|
config.set("spawn."+world+".yaw", location.getYaw());
|
|
plugin.saveConfig();
|
|
player.sendMessage("Spawn set.");
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
} |