Skip to content

Commit

Permalink
fix Death Event Cause (NPE), move GenericCheck to core
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Dec 15, 2019
1 parent df125e9 commit 0cdacf0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 32 deletions.
Expand Up @@ -312,37 +312,6 @@ public boolean runWithCheck(ScriptContainer scriptContainer, String s, String lo
return runWithCheck(new ScriptPath(scriptContainer, s), held);
}

public boolean runGenericCheck(String inputValue, String trueValue) {
if (inputValue != null) {
trueValue = CoreUtilities.toLowerCase(trueValue);
inputValue = CoreUtilities.toLowerCase(inputValue);
if (inputValue.equals(trueValue)) {
return true;
}
Pattern regexd = regexHandle(inputValue);
if (!equalityCheck(trueValue, inputValue, regexd)) {
return false;
}
}
return true;
}

public boolean runGenericSwitchCheck(ScriptPath path, String switchName, String value) {
String with = path.switches.get(switchName);
if (with != null) {
value = CoreUtilities.toLowerCase(value);
with = CoreUtilities.toLowerCase(with);
if (with.equals(value)) {
return true;
}
Pattern regexd = regexHandle(with);
if (!equalityCheck(value, with, regexd)) {
return false;
}
}
return true;
}

public boolean runWithCheck(ScriptPath path, ItemTag held) {
String with = path.switches.get("with");
if (with != null) {
Expand Down
Expand Up @@ -98,7 +98,7 @@ public boolean matches(ScriptPath path) {
return false;
}

if (!runGenericSwitchCheck(path, "cause", cause.asString())) {
if (!runGenericSwitchCheck(path, "cause", cause == null ? null : cause.asString())) {
return false;
}

Expand Down

0 comments on commit 0cdacf0

Please sign in to comment.