Skip to content
Permalink
Browse files

catch script event reload errors

  • Loading branch information...
mcmonkey4eva committed Feb 16, 2019
1 parent 4ed7eb6 commit 69ed3df37ac17bb19c687bac83a700923abb945a
Showing with 23 additions and 17 deletions.
  1. +23 −17 src/main/java/net/aufdemrand/denizencore/events/ScriptEvent.java
@@ -125,26 +125,32 @@ else if (evt.str.contains("@")) {
}
}
for (ScriptEvent event : events) {
event.destroy();
event.eventPaths.clear();
boolean matched = false;
for (ScriptContainer container : worldContainers) {
YamlConfiguration config = container.getConfigurationSection("events");
if (config == null) {
continue;
}
for (StringHolder evt1 : config.getKeys(false)) {
String evt = evt1.str.substring(3);
if (couldMatchScript(event, container, evt)) {
event.eventPaths.add(new ScriptPath(container, evt));
dB.log("Event match, " + event.getName() + " matched for '" + evt + "'!");
matched = true;
try {
event.destroy();
event.eventPaths.clear();
boolean matched = false;
for (ScriptContainer container : worldContainers) {
YamlConfiguration config = container.getConfigurationSection("events");
if (config == null) {
continue;
}
for (StringHolder evt1 : config.getKeys(false)) {
String evt = evt1.str.substring(3);
if (couldMatchScript(event, container, evt)) {
event.eventPaths.add(new ScriptPath(container, evt));
dB.log("Event match, " + event.getName() + " matched for '" + evt + "'!");
matched = true;
}
}
}
if (matched) {
event.sort();
event.init();
}
}
if (matched) {
event.sort();
event.init();
catch (Throwable ex) {
dB.echoError("Failed to reload event '" + event.getName() + "':");
dB.echoError(ex);
}
}
}

0 comments on commit 69ed3df

Please sign in to comment.
You can’t perform that action at this time.