aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryson Steck <steck.bryson@gmail.com>2021-07-19 18:14:51 -0600
committerBryson Steck <steck.bryson@gmail.com>2021-07-19 18:14:51 -0600
commit2be09b6fbc24a64bd98ecbb979e2c2e35c7af3d9 (patch)
treee48c39af74e4f5ae19d0aec4a41831bc4eeeb637
parent9715546f294083966e972e541e7ad0dea2b78533 (diff)
downloadresurrection-2be09b6fbc24a64bd98ecbb979e2c2e35c7af3d9.tar
resurrection-2be09b6fbc24a64bd98ecbb979e2c2e35c7af3d9.tar.gz
resurrection-2be09b6fbc24a64bd98ecbb979e2c2e35c7af3d9.tar.bz2
program exits if playerdata file creation fails
-rw-r--r--src/net/brysonsteck/Resurrection/Resurrection.java40
-rw-r--r--src/net/brysonsteck/Resurrection/commands/CommandHowLong.java6
2 files changed, 27 insertions, 19 deletions
diff --git a/src/net/brysonsteck/Resurrection/Resurrection.java b/src/net/brysonsteck/Resurrection/Resurrection.java
index 6a6492f..b3d9b99 100644
--- a/src/net/brysonsteck/Resurrection/Resurrection.java
+++ b/src/net/brysonsteck/Resurrection/Resurrection.java
@@ -48,24 +48,6 @@ public class Resurrection extends JavaPlugin implements Listener {
}
- System.out.println("[Resurrection] Locating the file \"playerData.resurrection\"...");
- // check if playerData.resurrection exists
- File playerFile = new File("plugins/playerData.resurrection");
- if (!playerFile.exists()) {
- System.out.println("[Resurrection] Player data file does not exist. Creating now in the \"plugins\" directory...");
- try {
- playerFile.createNewFile();
- System.out.println("[Resurrection] Player data file created successfully.");
- } catch (IOException e) {
- System.out.println("[Resurrection] An error has occurred creating the player data file!");
- e.printStackTrace();
- }
- } else {
- System.out.println("[Resurrection] The player data file has been found!");
- }
-
- System.out.println("[Resurrection] ---------------------------------------------------------");
-
// check for updates
System.out.println("[Resurrection] Checking for updates...");
CheckForUpdate check = new CheckForUpdate();
@@ -76,7 +58,7 @@ public class Resurrection extends JavaPlugin implements Listener {
if (pluginInfo.getVersion().equals(newestVersion)) {
System.out.println("[Resurrection] " + newestVersion + " is the latest version of Resurrection.");
} else {
- System.out.println("[Resurrection] A new version of Resurrection is available! (current: " + pluginInfo.getVersion() + ", newest: " + newestVersion);
+ System.out.println("[Resurrection] A new version of Resurrection is available! (current: " + pluginInfo.getVersion() + ", newest: " + newestVersion + ")");
System.out.println("[Resurrection] You can download the latest release on GitHub here \\/");
System.out.println("[Resurrection] " + newestVersionURL);
outdated = true;
@@ -85,6 +67,26 @@ public class Resurrection extends JavaPlugin implements Listener {
System.out.println("[Resurrection] ---------------------------------------------------------");
+ System.out.println("[Resurrection] Locating the file \"playerData.resurrection\"...");
+ // check if playerData.resurrection exists
+ File playerFile = new File("plugins/playerData.resurrection");
+ if (!playerFile.exists()) {
+ System.out.println("[Resurrection] Player data file does not exist. Creating now in the \"plugins\" directory...");
+ try {
+ playerFile.createNewFile();
+ System.out.println("[Resurrection] Player data file created successfully.");
+ } catch (IOException e) {
+ System.out.println("[Resurrection] An error has occurred creating the player data file!");
+ e.printStackTrace();
+ System.out.println("[Resurrection] This file is crucial to Resurrection. Since the file could not be created, the plugin will now stop.");
+ System.exit(1);
+ }
+ } else {
+ System.out.println("[Resurrection] The player data file has been found!");
+ }
+
+ System.out.println("[Resurrection] ---------------------------------------------------------");
+
System.out.println("[Resurrection] Registering listeners and adding commands...");
// register listener
this.getServer().getPluginManager().registerEvents(new PlayerListener(), this);
diff --git a/src/net/brysonsteck/Resurrection/commands/CommandHowLong.java b/src/net/brysonsteck/Resurrection/commands/CommandHowLong.java
index ecb955b..d4c2360 100644
--- a/src/net/brysonsteck/Resurrection/commands/CommandHowLong.java
+++ b/src/net/brysonsteck/Resurrection/commands/CommandHowLong.java
@@ -53,6 +53,12 @@ public class CommandHowLong implements CommandExecutor {
commandSender.sendMessage(p.getDisplayName() + " will respawn in " + timeCheck.formatTime());
}
return true;
+ } else {
+ if (self) {
+ commandSender.sendMessage("You aren't dead, dummy.");
+ } else {
+ commandSender.sendMessage("ERROR: " + p.getDisplayName() + " is not dead!");
+ }
}
}
}