Skip to content

Commit

Permalink
fix script event setup a little
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Feb 3, 2018
1 parent d7d53d7 commit 2a21729
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/java/net/aufdemrand/denizencore/events/ScriptEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public ScriptPath(ScriptContainer container, String event) {
public static void reload() {
dB.log("Reloading script events...");
for (ScriptContainer container : worldContainers) {
if (!container.getContents().getString("enabled", "true").equalsIgnoreCase("true")) {
continue;
}
YamlConfiguration config = container.getConfigurationSection("events");
if (config == null) {
dB.echoError("Missing or invalid events block for " + container.getName());
Expand Down Expand Up @@ -123,17 +126,14 @@ else if (evt.str.contains("@")) {
// A script event can at any time check the cancellation state of an event by accessing "<context.cancelled>".
// -->
public static boolean matchesScript(ScriptEvent sEvent, ScriptContainer script, String event) {
if (!script.getContents().getString("enabled", "true").equalsIgnoreCase("true")) {
return false;
}
String cancelmode = getSwitch(event, "cancelled");
if (cancelmode != null && cancelmode.equalsIgnoreCase("false") && sEvent.cancelled) {
return false;
}
else if (cancelmode != null && cancelmode.equalsIgnoreCase("true") && !sEvent.cancelled) {
if (cancelmode != null && cancelmode.equalsIgnoreCase("true") && !sEvent.cancelled) {
return false;
}
if (!checkSwitch(event, "ignorecancelled", "true") && sEvent.cancelled) {
if (checkSwitch(event, "ignorecancelled", "false") && sEvent.cancelled) {
return false;
}
return sEvent.matches(script, event);
Expand Down

0 comments on commit 2a21729

Please sign in to comment.