Skip to content

Commit

Permalink
add an error check to preloadScripts
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Mar 8, 2021
1 parent c6edf3b commit f5c2b22
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/main/java/com/denizenscript/denizencore/DenizenCore.java
Expand Up @@ -91,11 +91,17 @@ public static void init(DenizenImplementation implementation) {
* Call postLoadScripts after.
*/
public static void preloadScripts() {
PreScriptReloadScriptEvent.instance.fire();
ScriptEvent.worldContainers.clear();
implementation.preScriptReload();
ScriptHelper.resetError();
ScriptHelper.reloadScripts();
try {
PreScriptReloadScriptEvent.instance.fire();
ScriptEvent.worldContainers.clear();
implementation.preScriptReload();
ScriptHelper.resetError();
ScriptHelper.reloadScripts();
}
catch (Exception ex) {
implementation.debugMessage("Error loading scripts:");
implementation.debugException(ex);
}
}

/**
Expand All @@ -108,7 +114,6 @@ public static void postLoadScripts() {
OldEventManager.scanWorldEvents();
ScriptEvent.reload();
implementation.onScriptReload();

}
catch (Exception ex) {
implementation.debugMessage("Error loading scripts:");
Expand Down

0 comments on commit f5c2b22

Please sign in to comment.