Skip to content

Commit

Permalink
Catch notables saving errors, fixes #1426
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed May 27, 2016
1 parent 406e37a commit cd5416d
Showing 1 changed file with 9 additions and 10 deletions.
Expand Up @@ -141,7 +141,7 @@ private static void _recallNotables() {
obj.makeUnique(notable.replace("DOT", "."));
}
else {
dB.echoError("Notable '" + section.getString(notable).replace("DOT", ".") + "' failed to load!");
dB.echoError("Notable '" + notable.replace("DOT", ".") + "' failed to load!");
}
}

Expand All @@ -161,16 +161,15 @@ private static void _saveNotables() {

for (Map.Entry<String, Notable> notable : notableObjects.entrySet()) {

// If the object is serializable, save that info... fetching the objects back
// will require this information TODO: make this do something?..
// if (notable.getValue().getSaveObject() instanceof ConfigurationSerializable)
// DenizenAPI.getCurrentInstance().notableManager().getNotables()
// .set(getClassId(notable.getValue().getClass()) + "." + "_serializable", true);

notables.set(getClassId(getClass(notable.getValue())) + "." + CoreUtilities.toLowerCase(notable.getKey()).replace(".", "DOT"),
notable.getValue().getSaveObject());
try {
notables.set(getClassId(getClass(notable.getValue())) + "." + CoreUtilities.toLowerCase(notable.getKey()).replace(".", "DOT"),
notable.getValue().getSaveObject());
}
catch (Exception e) {
dB.echoError("Notable '" + notable.getKey() + "' failed to save!");
dB.echoError(e);
}
}

}

private static <T extends Notable> Class<T> getClass(Notable notable) {
Expand Down

0 comments on commit cd5416d

Please sign in to comment.