aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryson Steck <steck.bryson@gmail.com>2021-09-13 17:26:37 -0600
committerBryson Steck <steck.bryson@gmail.com>2021-09-13 17:26:37 -0600
commit897c2b72e62da77ccb267b5b33b3e9c4f376333a (patch)
tree854412de7b2c199b993270803360c1801ad47a35
parent9e8c0c2a881100939a63ba4d610af5d26b53938d (diff)
downloadresurrection-897c2b72e62da77ccb267b5b33b3e9c4f376333a.tar
resurrection-897c2b72e62da77ccb267b5b33b3e9c4f376333a.tar.gz
resurrection-897c2b72e62da77ccb267b5b33b3e9c4f376333a.tar.bz2
added debug messages to all where applicable
-rw-r--r--out/artifacts/Resurrection_jar/Resurrection.jarbin1601195 -> 1605273 bytes
-rw-r--r--src/net/brysonsteck/Resurrection/Resurrection.java2
-rw-r--r--src/net/brysonsteck/Resurrection/player/PlayerData.java6
-rw-r--r--src/net/brysonsteck/Resurrection/player/PlayerListener.java23
4 files changed, 26 insertions, 5 deletions
diff --git a/out/artifacts/Resurrection_jar/Resurrection.jar b/out/artifacts/Resurrection_jar/Resurrection.jar
index ba333af..e46419b 100644
--- a/out/artifacts/Resurrection_jar/Resurrection.jar
+++ b/out/artifacts/Resurrection_jar/Resurrection.jar
Binary files differ
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);
}
}