diff options
Diffstat (limited to 'src/net/brysonsteck/Resurrection/player')
-rw-r--r-- | src/net/brysonsteck/Resurrection/player/PlayerData.java | 6 | ||||
-rw-r--r-- | src/net/brysonsteck/Resurrection/player/PlayerListener.java | 23 |
2 files changed, 25 insertions, 4 deletions
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); } } |