added death command
This commit is contained in:
parent
9468552fdc
commit
60cddc4b50
@ -1,16 +1,31 @@
|
||||
package de.steev.bm.Commands;
|
||||
|
||||
import de.steev.bm.main;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class back implements CommandExecutor {
|
||||
// TODO save death coordinates in playerdata
|
||||
// TODO grab them
|
||||
// TODO ensure the position is safe
|
||||
// TODO teleport player back
|
||||
main plugin;
|
||||
|
||||
public back(main plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
|
||||
Player player = (Player) commandSender.getServer().getPlayer(commandSender.getName());
|
||||
Location lastDeath;
|
||||
try {
|
||||
lastDeath = plugin.playerDataConfig.getLocation(player.getUniqueId() + ".death");
|
||||
player.teleport(lastDeath);
|
||||
plugin.playerDataConfig.set(player.getUniqueId() + ".death", null);
|
||||
commandSender.sendMessage("Du wurdest Teleportiert. Dein todespunkt ist nun entfernt worden.");
|
||||
} catch (Exception ex) {
|
||||
commandSender.sendMessage("Tot nicht gefunden!");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -95,6 +95,10 @@ public class main extends JavaPlugin implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
public FileConfiguration getPlayerDataConfig(){
|
||||
return this.playerDataConfig;
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
// Even more Messaging
|
||||
this.getLogger().info(ChatColor.AQUA + "Ich geh dann mal :c");
|
||||
|
Loading…
x
Reference in New Issue
Block a user