diff --git a/src/main/java/com/massivecraft/massivecore/store/Coll.java b/src/main/java/com/massivecraft/massivecore/store/Coll.java index c4366560..a4cd8656 100644 --- a/src/main/java/com/massivecraft/massivecore/store/Coll.java +++ b/src/main/java/com/massivecraft/massivecore/store/Coll.java @@ -556,19 +556,34 @@ public class Coll implements CollInterface } catch (Exception e) { - MassiveCore.get().log(Txt.parse("Database could not load entity. You edited a file manually and made wrong JSON?")); - MassiveCore.get().log(Txt.parse("Error: %s", e.getMessage())); - MassiveCore.get().log(Txt.parse("Entity: %s", id)); - MassiveCore.get().log(Txt.parse("Collection: %s", this.getName())); + logLoadError(id, e.getMessage()); + return; + } + + if (entry == null) + { + logLoadError(id, "MStore driver could not load data entry. The file might not be readable or simply not exist."); return; } - if (entry == null) return; JsonElement raw = entry.getKey(); - if (raw == null) return; + if (raw == null) + { + logLoadError(id, "Raw data was null. Is the file completely empty?"); + return; + } + if (raw.isJsonNull()) + { + logLoadError(id, "Raw data was JSON null. It seems you have a file containing just the word \"null\". Why would you do this?"); + return; + } Long mtime = entry.getValue(); - if (mtime == null) return; + if (mtime == null) + { + logLoadError(id, "Last modification time (mtime) was null."); + return; + } // Calculate temp but handle raw cases. E temp = null; @@ -603,6 +618,14 @@ public class Coll implements CollInterface this.lastDefault.remove(id); } + public void logLoadError(String entityId, String error) + { + MassiveCore.get().log(Txt.parse("Database could not load entity. You edited a file manually and made wrong JSON?")); + MassiveCore.get().log(Txt.parse("Entity: %s", entityId)); + MassiveCore.get().log(Txt.parse("Collection: %s", this.getName())); + MassiveCore.get().log(Txt.parse("Error: %s", error)); + } + // -------------------------------------------- // // SYNC DECIDE AND BASIC DO // -------------------------------------------- //