From bb6e126297ac0767ee1e174eb3a7d710f2b7ab2b Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Wed, 16 Jun 2021 17:15:44 -0600 Subject: fixed file location --- data/player.data | 1 - data/playerData.resurrection | 1 + out/artifacts/Resurrection_jar/Resurrection.jar | Bin 1343846 -> 1344254 bytes .../brysonsteck/Resurrection/Resurrection.class | Bin 5303 -> 6112 bytes .../Resurrection/player/PlayerData.class | Bin 2642 -> 2683 bytes src/net/brysonsteck/Resurrection/Resurrection.java | 29 +++++++++++++++++++++ .../Resurrection/player/PlayerData.java | 6 ++--- 7 files changed, 33 insertions(+), 4 deletions(-) delete mode 100644 data/player.data create mode 100644 data/playerData.resurrection diff --git a/data/player.data b/data/player.data deleted file mode 100644 index d5d4ef7..0000000 --- a/data/player.data +++ /dev/null @@ -1 +0,0 @@ -username,false,0 \ No newline at end of file diff --git a/data/playerData.resurrection b/data/playerData.resurrection new file mode 100644 index 0000000..d5d4ef7 --- /dev/null +++ b/data/playerData.resurrection @@ -0,0 +1 @@ +username,false,0 \ No newline at end of file diff --git a/out/artifacts/Resurrection_jar/Resurrection.jar b/out/artifacts/Resurrection_jar/Resurrection.jar index 873cff4..0385297 100644 Binary files a/out/artifacts/Resurrection_jar/Resurrection.jar and b/out/artifacts/Resurrection_jar/Resurrection.jar differ diff --git a/out/production/Resurrection/net/brysonsteck/Resurrection/Resurrection.class b/out/production/Resurrection/net/brysonsteck/Resurrection/Resurrection.class index 4ca7e8f..1aef2dc 100644 Binary files a/out/production/Resurrection/net/brysonsteck/Resurrection/Resurrection.class and b/out/production/Resurrection/net/brysonsteck/Resurrection/Resurrection.class differ diff --git a/out/production/Resurrection/net/brysonsteck/Resurrection/player/PlayerData.class b/out/production/Resurrection/net/brysonsteck/Resurrection/player/PlayerData.class index 51cc93f..dde2427 100644 Binary files a/out/production/Resurrection/net/brysonsteck/Resurrection/player/PlayerData.class and b/out/production/Resurrection/net/brysonsteck/Resurrection/player/PlayerData.class differ diff --git a/src/net/brysonsteck/Resurrection/Resurrection.java b/src/net/brysonsteck/Resurrection/Resurrection.java index 5bb2683..bb86e5f 100644 --- a/src/net/brysonsteck/Resurrection/Resurrection.java +++ b/src/net/brysonsteck/Resurrection/Resurrection.java @@ -9,6 +9,8 @@ import org.bukkit.event.Listener; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.java.JavaPlugin; +import java.io.File; +import java.io.IOException; import java.util.Hashtable; public class Resurrection extends JavaPlugin implements Listener { @@ -39,8 +41,30 @@ public class Resurrection extends JavaPlugin implements Listener { System.out.println("[Resurrection] is up-to-date for more features and bug fixes. The plugin"); System.out.println("[Resurrection] will now check for updates."); System.out.println("[Resurrection] ---------------------------------------------------------"); + } else { + System.out.println("[Resurrection] ---------------------------------------------------------"); + } + System.out.println("[Resurrection] Locating the file \"playerData.resurrection\"..."); + // check if playerData.resurrection exists + File playerFile = new File("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(); @@ -54,6 +78,8 @@ public class Resurrection extends JavaPlugin implements Listener { System.out.println("[Resurrection] " + newestVersionURL); } + System.out.println("[Resurrection] ---------------------------------------------------------"); + // register listener this.getServer().getPluginManager().registerEvents(new PlayerListener(), this); @@ -62,7 +88,10 @@ public class Resurrection extends JavaPlugin implements Listener { this.getCommand("about").setExecutor(new CommandAbout()); this.getCommand("resurrect").setExecutor(new CommandResurrect()); + System.out.println("[Resurrection] ---------------------------------------------------------"); System.out.println("[Resurrection] Successfully Started!"); + System.out.println("[Resurrection] ---------------------------------------------------------"); + } public static void main(String[] args) { diff --git a/src/net/brysonsteck/Resurrection/player/PlayerData.java b/src/net/brysonsteck/Resurrection/player/PlayerData.java index 44dddb5..bdba51d 100644 --- a/src/net/brysonsteck/Resurrection/player/PlayerData.java +++ b/src/net/brysonsteck/Resurrection/player/PlayerData.java @@ -13,19 +13,19 @@ public class PlayerData { public void saveData(String write) { try { - FileWriter writer = new FileWriter("data/player.data"); + FileWriter writer = new FileWriter("playerData.resurrection"); writer.write(write); writer.close(); - readData(); } catch (IOException e) { e.printStackTrace(); } + readData(); } public void readData() { try { rawData = ""; - BufferedReader reader = new BufferedReader(new FileReader("data/player.data")); + BufferedReader reader = new BufferedReader(new FileReader("data/playerData.resurrection")); String line = ""; String[] playerData; while (true) { -- cgit v1.2.3