From fb22ed40df5b1599aefce668e8ce6e1c43643544 Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Tue, 15 Jun 2021 22:01:12 -0600 Subject: finally figured out how to edit player data. now how to save it... --- src/net/brysonsteck/Resurrection/player/PlayerData.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/net/brysonsteck/Resurrection/player') 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> 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 playerHash = new Hashtable<>(); playerHash.put("dead", playerData[1]); @@ -43,4 +49,8 @@ public class PlayerData { public Hashtable> getPlayers() { return playerData; } + + public String getRawData() { + return rawData; + } } -- cgit v1.2.3