diff options
-rw-r--r-- | out/artifacts/Resurrection_jar/Resurrection.jar | bin | 1601195 -> 1605273 bytes | |||
-rw-r--r-- | src/net/brysonsteck/Resurrection/Resurrection.java | 2 | ||||
-rw-r--r-- | src/net/brysonsteck/Resurrection/player/PlayerData.java | 6 | ||||
-rw-r--r-- | src/net/brysonsteck/Resurrection/player/PlayerListener.java | 23 |
4 files changed, 26 insertions, 5 deletions
diff --git a/out/artifacts/Resurrection_jar/Resurrection.jar b/out/artifacts/Resurrection_jar/Resurrection.jar Binary files differindex ba333af..e46419b 100644 --- a/out/artifacts/Resurrection_jar/Resurrection.jar +++ b/out/artifacts/Resurrection_jar/Resurrection.jar diff --git a/src/net/brysonsteck/Resurrection/Resurrection.java b/src/net/brysonsteck/Resurrection/Resurrection.java index 3d37900..e734fa0 100644 --- a/src/net/brysonsteck/Resurrection/Resurrection.java +++ b/src/net/brysonsteck/Resurrection/Resurrection.java @@ -110,7 +110,7 @@ public class Resurrection extends JavaPlugin implements Listener { System.out.println("[Resurrection] ---------------------------------------------------------"); } - System.out.println("[Resurrection] Registering listeners and adding commands..."); + System.out.println("[Resurrection] Essential files found and valid. Registering listeners and adding commands..."); // register listener this.getServer().getPluginManager().registerEvents(new PlayerListener(parseSettings), this); if (DEBUG) { diff --git a/src/net/brysonsteck/Resurrection/player/PlayerData.java b/src/net/brysonsteck/Resurrection/player/PlayerData.java index 4771af5..ceb8e38 100644 --- a/src/net/brysonsteck/Resurrection/player/PlayerData.java +++ b/src/net/brysonsteck/Resurrection/player/PlayerData.java @@ -33,11 +33,11 @@ public class PlayerData { System.out.println("[Resurrection] Resurrection will continue to run despite this error, but avoid shutting down the server until a successful save occurs."); System.out.println("[Resurrection] In the mean time, check to make sure the playerData file exists and you have permissions to write to it."); } - readData(); - if (DEBUG) { - Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: Player data saved successfully"); + Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: Player data saved successfully, rereading data to ensure Resurrection is up to date"); } + + readData(); } public void readData() { diff --git a/src/net/brysonsteck/Resurrection/player/PlayerListener.java b/src/net/brysonsteck/Resurrection/player/PlayerListener.java index 28bc619..539e328 100644 --- a/src/net/brysonsteck/Resurrection/player/PlayerListener.java +++ b/src/net/brysonsteck/Resurrection/player/PlayerListener.java @@ -139,6 +139,10 @@ public class PlayerListener implements Listener { } } }.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), timeToResurrection); + + if (DEBUG) { + Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: Player's resurrection thread is now delayed for (their time to resurrect - current time)"); + } } } @@ -169,6 +173,9 @@ public class PlayerListener implements Listener { int index = 0; for (String players : rawPlayers) { if (players.startsWith(p.getDisplayName())) { + if (DEBUG) { + Bukkit.broadcastMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + "[Res. DEBUG]: Player found in player data file, saving dead state"); + } String[] playerSplit = players.split(","); playerSplit[1] = "true"; playerSplit[2] = String.valueOf(resurrectionTime); @@ -188,7 +195,6 @@ public class PlayerListener implements Listener { // to ticks timeToResurrection = timeToResurrection * 20; - new BukkitRunnable() { // save death information to player file @Override @@ -222,17 +228,28 @@ public class PlayerListener implements Listener { } } }.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), timeToResurrection); + + if (DEBUG) { + Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: Player's resurrection thread is now delayed for resurrection_time"); + } } @EventHandler public void onPlayerRespawn(PlayerRespawnEvent e) { if (stillDead) { final Player p = e.getPlayer(); + if (DEBUG) { + Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: Player " + p.getDisplayName() + " has respawned before their resurrection time"); + } + TimeCheck timeCheck = new TimeCheck(Long.parseLong(parseSettings.getSetting("resurrection_time"))); playerSpawns.put(p.getDisplayName(), p.getLocation()); p.setGameMode(GameMode.SPECTATOR); p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "YOU HAVE DIED!!"); p.sendMessage(ChatColor.RED + "You will be able to respawn in the next " + timeCheck.formatTime('f')); + if (DEBUG) { + Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: Applying potions, spectator mode"); + } new BukkitRunnable() { @Override public void run() { @@ -252,6 +269,10 @@ public class PlayerListener implements Listener { public void onPlayerMove(PlayerMoveEvent e) { Player p = e.getPlayer(); if (p.getGameMode() == GameMode.SPECTATOR) { + if (DEBUG) { + Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + "[Res. DEBUG]: Player " + p.getDisplayName() + " attempted to move while in dead state, teleporting to spawn until their resurrection time"); + } + p.teleport(spawn); } } |