Skip to content

Commit

Permalink
improve if command
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jun 28, 2018
1 parent 3f1ec62 commit 9f8d24b
Showing 1 changed file with 10 additions and 6 deletions.
Expand Up @@ -125,17 +125,21 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {
}
List<String> key = braceSet.args;
boolean should_fire = false;
if (key.size() > 0 && key.get(0).equalsIgnoreCase("else")) {
key.remove(0);
int x = 0;
if (key.size() > x && key.get(x).equalsIgnoreCase("else")) {
x++;
}
if (key.size() > 0 && key.get(0).equalsIgnoreCase("if")) {
key.remove(0);
else {
dB.echoError("If command has argument '" + key.get(x) + "' which is unknown.");
}
if (key.size() > x && key.get(x).equalsIgnoreCase("if")) {
x++;
}
else {
should_fire = true;
}
if (!should_fire) {
if (new ArgComparer().compare(key, scriptEntry)) {
if (new ArgComparer().compare(key.subList(x, key.size()), scriptEntry)) {
should_fire = true;
}
}
Expand Down Expand Up @@ -292,7 +296,7 @@ public ArgInternal tagme(int arg) {
}

public ArgComparer construct(List args, ScriptEntry scriptEntry) {
argstemp = new ArrayList(args);
argstemp = args;
argstemp_parsed = new ArgInternal[args.size()];
this.scriptEntry = scriptEntry;
return this;
Expand Down

0 comments on commit 9f8d24b

Please sign in to comment.