Fix startup error that may happen when factions is shutdown improperly
This commit is contained in:
parent
0444517eec
commit
81ef43768d
@ -73,6 +73,7 @@ public class JSONFPlayers extends MemoryFPlayers {
|
||||
if (!this.file.exists()) return new HashMap<>();
|
||||
String content = DiscUtil.readCatch(this.file);
|
||||
if (content == null) return null;
|
||||
try {
|
||||
Map<String, JSONFPlayer> data = this.gson.fromJson(content, new TypeToken<Map<String, JSONFPlayer>>() {
|
||||
}.getType());
|
||||
Set<String> list = new HashSet<>();
|
||||
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user