Skip to content

Commit

Permalink
improvement events efficiency
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Mar 16, 2019
1 parent bb47fe3 commit 199f5ad
Show file tree
Hide file tree
Showing 105 changed files with 165 additions and 165 deletions.
Expand Up @@ -58,12 +58,12 @@ public boolean matches(ScriptPath path) {
return false;
}

String mat1 = CoreUtilities.getXthArg(0, lower);
String mat1 = path.eventArgLowerAt(0);
if (!tryMaterial(new_material, mat1)) {
return false;
}

String mat2 = CoreUtilities.getXthArg(4, lower);
String mat2 = path.eventArgLowerAt(4);
if (mat2.length() > 0 && !tryMaterial(old_material, mat2)) {
return false;
}
Expand Down
Expand Up @@ -54,7 +54,7 @@ public boolean matches(ScriptPath path) {
return false;
}

String mat = CoreUtilities.getXthArg(0, lower);
String mat = path.eventArgLowerAt(0);
return tryMaterial(material, mat);

}
Expand Down
Expand Up @@ -67,8 +67,8 @@ public boolean matches(ScriptPath path) {
return false;
}

String dispenser = CoreUtilities.getXthArg(0, lower);
String iTest = CoreUtilities.getXthArg(2, lower);
String dispenser = path.eventArgLowerAt(0);
String iTest = path.eventArgLowerAt(2);
return tryMaterial(material, dispenser) && (iTest.equals("item") || tryItem(item, iTest));
}

Expand Down
Expand Up @@ -53,7 +53,7 @@ public boolean matches(ScriptPath path) {
return false;
}

String mat = CoreUtilities.getXthArg(0, lower);
String mat = path.eventArgLowerAt(0);
return tryMaterial(material, mat);
}

Expand Down
Expand Up @@ -56,7 +56,7 @@ public boolean matches(ScriptPath path) {
return false;
}

String mat = CoreUtilities.getXthArg(0, lower);
String mat = path.eventArgLowerAt(0);
return tryMaterial(material, mat);
}

Expand Down
Expand Up @@ -53,7 +53,7 @@ public boolean matches(ScriptPath path) {
return false;
}

String mat = CoreUtilities.getXthArg(0, lower);
String mat = path.eventArgLowerAt(0);
return tryMaterial(material, mat);
}

Expand Down
Expand Up @@ -51,7 +51,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
@Override
public boolean matches(ScriptPath path) {
String lower = path.eventLower;
String mat = CoreUtilities.getXthArg(0, lower);
String mat = path.eventArgLowerAt(0);
if (!tryMaterial(material, mat)) {
return false;
}
Expand Down
Expand Up @@ -61,7 +61,7 @@ public boolean matches(ScriptPath path) {
return false;
}

String mat = CoreUtilities.getXthArg(0, lower);
String mat = path.eventArgLowerAt(0);
return tryMaterial(material, mat);
}

Expand Down
Expand Up @@ -60,7 +60,7 @@ public boolean matches(ScriptPath path) {
return false;
}

String mat = CoreUtilities.getXthArg(0, lower);
String mat = path.eventArgLowerAt(0);
return tryMaterial(material, mat);

}
Expand Down
Expand Up @@ -56,7 +56,7 @@ public boolean matches(ScriptPath path) {
return false;
}

String mat = CoreUtilities.getXthArg(0, lower);
String mat = path.eventArgLowerAt(0);
return tryMaterial(material, mat);

}
Expand Down
Expand Up @@ -50,7 +50,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
public boolean matches(ScriptPath path) {
String lower = path.eventLower;

if (CoreUtilities.getXthArg(2, lower).equals("because")
if (path.eventArgLowerAt(2).equals("because")
&& !CoreUtilities.xthArgEquals(3, lower, CoreUtilities.toLowerCase(cause.toString()))) {
return false;
}
Expand Down
Expand Up @@ -66,8 +66,8 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
@Override
public boolean matches(ScriptPath path) {
String lower = path.eventLower;
String entName = CoreUtilities.getXthArg(0, lower);
String hang = CoreUtilities.getXthArg(2, lower);
String entName = path.eventArgLowerAt(0);
String hang = path.eventArgLowerAt(2);

if (!tryEntity(breaker, entName)) {
return false;
Expand All @@ -81,7 +81,7 @@ public boolean matches(ScriptPath path) {
return false;
}

if (CoreUtilities.xthArgEquals(3, lower, "because") && !CoreUtilities.getXthArg(4, lower).equals(CoreUtilities.toLowerCase(cause.asString()))) {
if (path.eventArgLowerAt(3).equals("because") && !path.eventArgLowerAt(4).equals(CoreUtilities.toLowerCase(cause.asString()))) {
return false;
}

Expand Down
Expand Up @@ -66,7 +66,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
public boolean matches(ScriptPath path) {
String lower = path.eventLower;

if (!tryEntity(entity, CoreUtilities.getXthArg(0, lower))) {
if (!tryEntity(entity, path.eventArgLowerAt(0))) {
return false;
}

Expand Down
Expand Up @@ -64,18 +64,18 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
@Override
public boolean matches(ScriptPath path) {
String lower = path.eventLower;
String entName = CoreUtilities.getXthArg(0, lower);
String entName = path.eventArgLowerAt(0);

if (!tryEntity(entity, entName)) {
return false;
}

if (!tryMaterial(old_material, CoreUtilities.getXthArg(2, lower))) {
if (!tryMaterial(old_material, path.eventArgLowerAt(2))) {
return false;
}

if (CoreUtilities.xthArgEquals(3, lower, "into")) {
String mat2 = CoreUtilities.getXthArg(4, lower);
if (path.eventArgLowerAt(3).equals("into")) {
String mat2 = path.eventArgLowerAt(4);
if (mat2.isEmpty()) {
dB.echoError("Invalid event material [" + getName() + "]: '" + path.event + "' for " + path.container.getName());
return false;
Expand Down
Expand Up @@ -65,7 +65,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
public boolean matches(ScriptPath path) {
String lower = path.eventLower;

if (!tryEntity(entity, CoreUtilities.getXthArg(0, lower))) {
if (!tryEntity(entity, path.eventArgLowerAt(0))) {
return false;
}

Expand Down
Expand Up @@ -52,7 +52,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
public boolean matches(ScriptPath path) {
String lower = path.eventLower;

if (!tryEntity(entity, CoreUtilities.getXthArg(0, lower))) {
if (!tryEntity(entity, path.eventArgLowerAt(0))) {
return false;
}

Expand Down
Expand Up @@ -90,10 +90,10 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
@Override
public boolean matches(ScriptPath path) {
String lower = path.eventLower;
String cmd = CoreUtilities.getXthArg(1, lower);
String attacker = cmd.equals("damages") ? CoreUtilities.getXthArg(0, lower) :
CoreUtilities.getXthArg(2, lower).equals("by") ? CoreUtilities.getXthArg(3, lower) : "";
String target = cmd.equals("damages") ? CoreUtilities.getXthArg(2, lower) : CoreUtilities.getXthArg(0, lower);
String cmd = path.eventArgLowerAt(1);
String attacker = cmd.equals("damages") ? path.eventArgLowerAt(0) :
path.eventArgLowerAt(2).equals("by") ? path.eventArgLowerAt(3) : "";
String target = cmd.equals("damages") ? path.eventArgLowerAt(2) : path.eventArgLowerAt(0);

if (!attacker.isEmpty()) {
if (damager != null) {
Expand Down
Expand Up @@ -94,7 +94,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
@Override
public boolean matches(ScriptPath path) {
String lower = path.eventLower;
String target = CoreUtilities.getXthArg(0, lower);
String target = path.eventArgLowerAt(0);

if (!tryEntity(entity, target)) {
return false;
Expand Down
Expand Up @@ -50,7 +50,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
@Override
public boolean matches(ScriptPath path) {
String lower = path.eventLower;
String target = CoreUtilities.getXthArg(0, lower);
String target = path.eventArgLowerAt(0);

if (!tryEntity(entity, target)) {
return false;
Expand Down
Expand Up @@ -51,7 +51,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
@Override
public boolean matches(ScriptPath path) {
String lower = path.eventLower;
String target = CoreUtilities.getXthArg(0, lower);
String target = path.eventArgLowerAt(0);

if (!tryEntity(entity, target)) {
return false;
Expand Down
Expand Up @@ -58,8 +58,8 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
public boolean matches(ScriptPath path) {
String lower = path.eventLower;

if (!tryEntity(entity, CoreUtilities.getXthArg(0, lower))
|| !tryEntity(vehicle, CoreUtilities.getXthArg(2, lower))) {
if (!tryEntity(entity, path.eventArgLowerAt(0))
|| !tryEntity(vehicle, path.eventArgLowerAt(2))) {
return false;
}

Expand Down
Expand Up @@ -51,7 +51,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
@Override
public boolean matches(ScriptPath path) {
String lower = path.eventLower;
String target = CoreUtilities.getXthArg(0, lower);
String target = path.eventArgLowerAt(0);

if (!tryEntity(entity, target)) {
return false;
Expand Down
Expand Up @@ -55,8 +55,8 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
public boolean matches(ScriptPath path) {
String lower = path.eventLower;

if (!tryEntity(entity, CoreUtilities.getXthArg(0, lower))
|| !tryEntity(vehicle, CoreUtilities.getXthArg(2, lower))) {
if (!tryEntity(entity, path.eventArgLowerAt(0))
|| !tryEntity(vehicle, path.eventArgLowerAt(2))) {
return false;
}

Expand Down
Expand Up @@ -63,7 +63,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
@Override
public boolean matches(ScriptPath path) {
String lower = path.eventLower;
String target = CoreUtilities.getXthArg(0, lower);
String target = path.eventArgLowerAt(0);

if (!tryEntity(entity, target)) {
return false;
Expand Down
Expand Up @@ -50,7 +50,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
public boolean matches(ScriptPath path) {
String lower = path.eventLower;

if (!tryEntity(entity, CoreUtilities.getXthArg(0, lower))) {
if (!tryEntity(entity, path.eventArgLowerAt(0))) {
return false;
}

Expand Down
Expand Up @@ -57,7 +57,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
@Override
public boolean matches(ScriptPath path) {
String lower = path.eventLower;
String target = CoreUtilities.getXthArg(0, lower);
String target = path.eventArgLowerAt(0);

if (!tryEntity(entity, target)) {
return false;
Expand Down
Expand Up @@ -57,11 +57,11 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
public boolean matches(ScriptPath path) {
String lower = path.eventLower;

if (!tryEntity(entity, CoreUtilities.getXthArg(0, lower))) {
if (!tryEntity(entity, path.eventArgLowerAt(0))) {
return false;
}

if (!tryMaterial(material, CoreUtilities.getXthArg(2, lower))) {
if (!tryMaterial(material, path.eventArgLowerAt(2))) {
return false;
}

Expand Down
Expand Up @@ -54,11 +54,11 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
public boolean matches(ScriptPath path) {
String lower = path.eventLower;

if (!tryEntity(entity, CoreUtilities.getXthArg(0, lower))) {
if (!tryEntity(entity, path.eventArgLowerAt(0))) {
return false;
}

String cmd = CoreUtilities.getXthArg(1, lower);
String cmd = path.eventArgLowerAt(1);
if (cmd.equals("starts") && !state) {
return false;
}
Expand Down
Expand Up @@ -60,12 +60,12 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
public boolean matches(ScriptPath path) {
String lower = path.eventLower;

if (!tryEntity(entity, CoreUtilities.getXthArg(0, lower))) {
if (!tryEntity(entity, path.eventArgLowerAt(0))) {
return false;
}

if (CoreUtilities.getXthArg(2, lower).equals("because") &&
!CoreUtilities.getXthArg(3, lower).equals(CoreUtilities.toLowerCase(reason.toString()))) {
if (path.eventArgLowerAt(2).equals("because") &&
!path.eventArgLowerAt(3).equals(CoreUtilities.toLowerCase(reason.toString()))) {
return false;
}

Expand Down
Expand Up @@ -58,11 +58,11 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
public boolean matches(ScriptPath path) {
String lower = path.eventLower;

if (!tryEntity(entity, CoreUtilities.getXthArg(0, lower))) {
if (!tryEntity(entity, path.eventArgLowerAt(0))) {
return false;
}

if (!tryMaterial(material, CoreUtilities.getXthArg(3, lower))) {
if (!tryMaterial(material, path.eventArgLowerAt(3))) {
return false;
}

Expand Down
Expand Up @@ -83,10 +83,10 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
@Override
public boolean matches(ScriptPath path) {
String lower = path.eventLower;
String cmd = CoreUtilities.getXthArg(1, lower);
String arg0 = CoreUtilities.getXthArg(0, lower);
String arg2 = CoreUtilities.getXthArg(2, lower);
String arg3 = CoreUtilities.getXthArg(3, lower);
String cmd = path.eventArgLowerAt(1);
String arg0 = path.eventArgLowerAt(0);
String arg2 = path.eventArgLowerAt(2);
String arg3 = path.eventArgLowerAt(3);
String attacker = cmd.equals("kills") ? arg0 : arg2.equals("by") ? arg3 : "";
String target = cmd.equals("kills") ? arg2 : arg0;

Expand Down
Expand Up @@ -50,7 +50,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
public boolean matches(ScriptPath path) {
String lower = path.eventLower;

if (!tryEntity(entity, CoreUtilities.getXthArg(0, lower))) {
if (!tryEntity(entity, path.eventArgLowerAt(0))) {
return false;
}

Expand Down
Expand Up @@ -71,8 +71,8 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
@Override
public boolean matches(ScriptPath path) {
String lower = path.eventLower;
String attacker = CoreUtilities.getXthArg(0, lower);
String item = CoreUtilities.getXthArg(2, lower);
String attacker = path.eventArgLowerAt(0);
String item = path.eventArgLowerAt(2);

if (!tryEntity(entity, attacker)) {
return false;
Expand Down
Expand Up @@ -64,12 +64,12 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
public boolean matches(ScriptPath path) {
String lower = path.eventLower;

if (!tryEntity(entity, CoreUtilities.getXthArg(0, lower))) {
if (!tryEntity(entity, path.eventArgLowerAt(0))) {
return false;
}

if (CoreUtilities.xthArgEquals(2, lower, "because")
&& !CoreUtilities.getXthArg(3, lower).equalsIgnoreCase(reason.toString())) {
if (path.eventArgLowerAt(2).equals("because")
&& !path.eventArgLowerAt(3).equalsIgnoreCase(reason.toString())) {
return false;
}

Expand Down
Expand Up @@ -53,7 +53,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
public boolean matches(ScriptPath path) {
String lower = path.eventLower;

if (!tryEntity(entity, CoreUtilities.getXthArg(2, lower))) {
if (!tryEntity(entity, path.eventArgLowerAt(2))) {
return false;
}

Expand Down

0 comments on commit 199f5ad

Please sign in to comment.