some bugs fixed
DeathListener still not working
This commit is contained in:
parent
3b2be4a9b3
commit
7651b14c93
3 changed files with 56 additions and 6 deletions
|
@ -27,9 +27,13 @@ public class DeathListener implements Listener {
|
|||
Location location = player.getLocation();
|
||||
String worldString = (String) location.getWorld().getName();
|
||||
|
||||
player.sendMessage(timeString);
|
||||
player.sendMessage(playerString);
|
||||
player.sendMessage(worldString);
|
||||
|
||||
if (worldString == "hardcore"){
|
||||
plugin.deathMap.put(playerString, timeString);
|
||||
player.sendMessage(plugin.deathMap.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,18 +21,41 @@ public class HelloWorld implements CommandExecutor {
|
|||
sender.sendMessage("WELL, AT LEAST THIS WORKS");
|
||||
if (sender instanceof Player){
|
||||
|
||||
String playername = sender.getName();
|
||||
int deathtime = Integer.parseInt(plugin.deathMap.get(playername));
|
||||
long currentTime = System.currentTimeMillis();
|
||||
int timeInt = (int) currentTime;
|
||||
sender.sendMessage("sender IS instanceof Player");
|
||||
|
||||
if (timeInt - deathtime >= 86400000){
|
||||
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));
|
||||
|
||||
if (currentTime - deathTime >= 86400000){
|
||||
|
||||
sender.sendMessage("more than 24 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 - (timeInt - deathtime))/3600000) + "hours");
|
||||
sender.sendMessage("you are dead for the next " + (86400000 - (currentTime - deathTime) ) /3600000 + " hours");
|
||||
}
|
||||
|
||||
}else{
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package iie;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class publicstaticvoidmain {
|
||||
|
||||
public static void main(String[] args){
|
||||
System.out.println("Hello World!");
|
||||
|
||||
|
@ -9,10 +13,29 @@ public class publicstaticvoidmain {
|
|||
int test2 = Integer.parseInt(testString);
|
||||
System.out.println(test2);
|
||||
|
||||
if (test == 1234){
|
||||
test = 12345;
|
||||
}
|
||||
|
||||
System.out.println(test);
|
||||
|
||||
|
||||
long currentTime = System.currentTimeMillis();
|
||||
|
||||
System.out.println(currentTime);
|
||||
|
||||
System.out.println(Long.parseLong("1472003809703"));
|
||||
|
||||
AbstractMap<String,String> deathMap = new HashMap<String,String>();
|
||||
deathMap.put("test", "1472003809703");
|
||||
long deathTime = Long.parseLong(deathMap.get("test"));
|
||||
System.out.println(deathMap.get("test"));
|
||||
System.out.println(deathTime + " is a number");
|
||||
|
||||
System.out.println(deathMap.get("other"));
|
||||
System.out.println("you are dead for the next " + ((86400000 - (currentTime - deathTime))/3600000) + " hours");
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue