diff --git a/varo/src/main/java/de/cliffbreak/varo/uitls/JSONConfig.java b/varo/src/main/java/de/cliffbreak/varo/uitls/JSONConfig.java index a067544..f8789ec 100644 --- a/varo/src/main/java/de/cliffbreak/varo/uitls/JSONConfig.java +++ b/varo/src/main/java/de/cliffbreak/varo/uitls/JSONConfig.java @@ -11,7 +11,6 @@ import java.util.TreeMap; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import org.bukkit.ChatColor; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; @@ -78,6 +77,8 @@ public class JSONConfig { fw.flush(); fw.close(); + this.reload(); + return true; } catch (final Exception ex) { ex.printStackTrace(); @@ -91,7 +92,7 @@ public class JSONConfig { } private String getString(final String key) { - return ChatColor.translateAlternateColorCodes('&', getRawData(key)); + return getRawData(key); } private double getDouble(final String key) { @@ -119,4 +120,11 @@ public class JSONConfig { return this.json.containsKey(key) ? (JSONArray) json.get(key) : (this.defaults.containsKey(key) ? (JSONArray) this.defaults.get(key) : new JSONArray()); } + + @SuppressWarnings("unchecked") + public void updatePlayerName(final int teamKey, final int playerKey, final String name) { + ((JSONObject) ((JSONArray) ((JSONObject) ((JSONArray) this.json.get("teams")).get(teamKey)).get("players")) + .get(playerKey)).put("name", name); + this.save(); + } } \ No newline at end of file