added debug messages to all where applicable
This commit is contained in:
parent
9e8c0c2a88
commit
897c2b72e6
4 changed files with 26 additions and 5 deletions
Binary file not shown.
|
@ -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) {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue