diff options
author | Bryson Steck <steck.bryson@gmail.com> | 2021-06-15 22:01:12 -0600 |
---|---|---|
committer | Bryson Steck <steck.bryson@gmail.com> | 2021-06-15 22:01:12 -0600 |
commit | fb22ed40df5b1599aefce668e8ce6e1c43643544 (patch) | |
tree | a4f4e8a95e6e92ca997c5b5fc35d15a71c9f070e /src/net/brysonsteck/Resurrection/player | |
parent | 34e7a03d283051b81fee60a67170ea22c672f81d (diff) | |
download | resurrection-fb22ed40df5b1599aefce668e8ce6e1c43643544.tar resurrection-fb22ed40df5b1599aefce668e8ce6e1c43643544.tar.gz resurrection-fb22ed40df5b1599aefce668e8ce6e1c43643544.tar.bz2 |
finally figured out how to edit player data. now how to save it...
Diffstat (limited to 'src/net/brysonsteck/Resurrection/player')
-rw-r--r-- | src/net/brysonsteck/Resurrection/player/PlayerData.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/net/brysonsteck/Resurrection/player/PlayerData.java b/src/net/brysonsteck/Resurrection/player/PlayerData.java index a8a1192..cc82952 100644 --- a/src/net/brysonsteck/Resurrection/player/PlayerData.java +++ b/src/net/brysonsteck/Resurrection/player/PlayerData.java @@ -1,16 +1,20 @@ package net.brysonsteck.Resurrection.player; +import net.brysonsteck.Resurrection.Resurrection; +import org.bukkit.plugin.java.JavaPlugin; + import java.io.*; import java.util.Arrays; import java.util.Hashtable; public class PlayerData { Hashtable<String, Hashtable<String, String>> playerData = new Hashtable<>(); + String rawData; public void saveData(String write) { try { FileWriter writer = new FileWriter("data/player.data"); - writer.write(write); + writer.write(rawData + ";" + write); writer.close(); readData(); } catch (IOException e) { @@ -20,6 +24,7 @@ public class PlayerData { public void readData() { try { + rawData = ""; BufferedReader reader = new BufferedReader(new FileReader("data/player.data")); String line = ""; String[] playerData; @@ -29,6 +34,7 @@ public class PlayerData { if (line == null) { break; } + rawData = rawData + line; playerData = line.split(","); Hashtable<String, String> playerHash = new Hashtable<>(); playerHash.put("dead", playerData[1]); @@ -43,4 +49,8 @@ public class PlayerData { public Hashtable<String, Hashtable<String, String>> getPlayers() { return playerData; } + + public String getRawData() { + return rawData; + } } |