diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONFPlayers.java b/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONFPlayers.java index 78f0bf1a..d0f35ba0 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONFPlayers.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONFPlayers.java @@ -73,21 +73,22 @@ public class JSONFPlayers extends MemoryFPlayers { if (!this.file.exists()) return new HashMap<>(); String content = DiscUtil.readCatch(this.file); if (content == null) return null; - Map data = this.gson.fromJson(content, new TypeToken>() { - }.getType()); - Set list = new HashSet<>(); - Set invalidList = new HashSet<>(); - for (Entry entry : data.entrySet()) { - String key = entry.getKey(); - entry.getValue().setId(key); - if (doesKeyNeedMigration(key)) { - if (!isKeyInvalid(key)) { - list.add(key); - } else { - invalidList.add(key); + try { + Map data = this.gson.fromJson(content, new TypeToken>() { + }.getType()); + Set list = new HashSet<>(); + Set invalidList = new HashSet<>(); + for (Entry entry : data.entrySet()) { + String key = entry.getKey(); + entry.getValue().setId(key); + if (doesKeyNeedMigration(key)) { + if (!isKeyInvalid(key)) { + list.add(key); + } else { + invalidList.add(key); + } } } - } if (list.size() > 0) { // We've got some converting to do! @@ -150,6 +151,14 @@ public class JSONFPlayers extends MemoryFPlayers { Bukkit.getLogger().log(Level.INFO, "Done converting players.json to UUID."); } return data; + } catch (NullPointerException exception) { + exception.printStackTrace(); + if (this.file.length() < 200) { + return new HashMap<>(); + } else { + throw exception; + } + } } private boolean doesKeyNeedMigration(String key) {