some more small changes
This commit is contained in:
parent
7651b14c93
commit
42fd476ff7
1 changed files with 33 additions and 29 deletions
|
@ -18,51 +18,55 @@ public class HelloWorld implements CommandExecutor {
|
|||
public boolean onCommand(CommandSender sender, Command label, String command, String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
sender.sendMessage("WELL, AT LEAST THIS WORKS");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//sender.sendMessage("WELL, AT LEAST THIS WORKS");
|
||||
|
||||
if (sender instanceof Player){
|
||||
|
||||
sender.sendMessage("sender IS instanceof Player");
|
||||
|
||||
//sender.sendMessage("sender IS instanceof Player");
|
||||
long currentTime = System.currentTimeMillis();
|
||||
String playername = sender.getName();
|
||||
long deathTime = 0;
|
||||
|
||||
if (plugin.deathMap.get(playername) != null){
|
||||
|
||||
deathTime = Long.parseLong(plugin.deathMap.get(playername));
|
||||
|
||||
}else{
|
||||
|
||||
sender.sendMessage("you have never died in hardcore");
|
||||
|
||||
Player player = (Player) sender;
|
||||
World hardcoreWorld = player.getServer().getWorld("hardcore");
|
||||
Location location = new Location(hardcoreWorld, 1280, 71, -179);
|
||||
player.teleport(location);
|
||||
}
|
||||
|
||||
sender.sendMessage(playername);
|
||||
sender.sendMessage(String.valueOf(deathTime));
|
||||
sender.sendMessage(String.valueOf(currentTime));
|
||||
//sender.sendMessage(playername);
|
||||
//sender.sendMessage(String.valueOf(deathTime));
|
||||
//sender.sendMessage(String.valueOf(currentTime));
|
||||
|
||||
if (currentTime - deathTime >= 86400000){
|
||||
|
||||
sender.sendMessage("more than 24 hours have passed since you died in hardcore last");
|
||||
|
||||
if (currentTime - deathTime >= 86400000 && deathTime != 0){
|
||||
sender.sendMessage((86400000 - (currentTime - deathTime) ) /3600000 + " hours have passed since you died in hardcore last");
|
||||
Player player = (Player) sender;
|
||||
World hardcoreWorld = player.getServer().getWorld("hardcore");
|
||||
Location location = new Location(hardcoreWorld, 1280, 71, -179);
|
||||
player.teleport(location);
|
||||
|
||||
}else{
|
||||
sender.sendMessage("you are dead for the next " + (86400000 - (currentTime - deathTime) ) /3600000 + " hours");
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
sender.sendMessage("You must be a player to use this command!");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue