Skip to content

Commit

Permalink
repatch that
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Nov 21, 2018
1 parent b7cec80 commit fbf6fb7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
Expand Up @@ -360,14 +360,6 @@ public ScriptEntry defaultObject(String key, Object... objects) throws InvalidAr
}
}

public List<String> getProperArguments() {
List<String> args_temp = new ArrayList<>();
for (Argument arg : args_cur) {
args_temp.add(arg.aHArg.toString());
}
return args_temp;
}

public List<String> getArguments() {
return args;
}
Expand Down
Expand Up @@ -68,7 +68,7 @@ public static List<BracedData> getBracedCommands(ScriptEntry scriptEntry) {
if (bd.needPatch) {
newbd.args = new ArrayList<String>(bd.args.size());
for (int x = bd.aStart; x <= bd.aEnd; x++) {
newbd.args.add(scriptEntry.args.get(x));
newbd.args.add(CommandExecuter.parseDefsRaw(scriptEntry, scriptEntry.args.get(x)));
}
break;
}
Expand Down
Expand Up @@ -20,7 +20,7 @@ public CommandExecuter() {
}

public static String parseDefsRaw(ScriptEntry scriptEntry, String arg) {
if (arg.indexOf('%') == -1) {
if (!hasDef(arg)) {
return arg;
}
Matcher m;
Expand Down Expand Up @@ -54,6 +54,10 @@ public static String parseDefsRaw(ScriptEntry scriptEntry, String arg) {
return sb.toString();
}

public static boolean hasDef(String arg) {
return arg.indexOf('%') != -1;
}

public static boolean handleDefs(ScriptEntry scriptEntry, boolean genned) {
if (scriptEntry.internal.hasOldDefs) {
if (!genned) {
Expand All @@ -62,7 +66,7 @@ public static boolean handleDefs(ScriptEntry scriptEntry, boolean genned) {
}
for (int argId : scriptEntry.internal.processArgs) {
String arg = scriptEntry.args.get(argId);
if (arg.indexOf('%') != -1) {
if (hasDef(arg)) {
String parsed = parseDefsRaw(scriptEntry, arg);
scriptEntry.setArgument(argId, parsed);
aH.Argument aharg = new aH.Argument(parsed);
Expand Down
Expand Up @@ -58,7 +58,7 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException
elseRef.key = nextEntry.toString();
elseRef.args = new ArrayList<>();
elseRef.args.add("else");
elseRef.args.addAll(nextEntry.getProperArguments());
elseRef.args.addAll(nextEntry.getArguments());
allData.add(elseRef);
}
scriptEntry.addObject("braces", allData);
Expand Down

0 comments on commit fbf6fb7

Please sign in to comment.