SteamWar/BauSystem2.0
Archiviert
12
0

Simplify ScriptExecutor

Dieser Commit ist enthalten in:
yoyosource 2021-04-21 11:42:59 +02:00
Ursprung 5e5881cf4c
Commit 1c91105367

Datei anzeigen

@ -68,7 +68,7 @@ public final class ScriptExecutor {
return; return;
} }
String[] strings = generateStringArray(command); String[] strings = replaceVariables(command);
if (strings.length == 0) { if (strings.length == 0) {
return; return;
} }
@ -99,12 +99,8 @@ public final class ScriptExecutor {
} }
} }
private String[] generateStringArray(String command) { private String[] replaceVariables(String s) {
return replaceVariables(command.replaceAll(" +", " ").split(" ")); s = s.replaceAll(" +", " ");
}
private String[] replaceVariables(String[] args) {
String s = String.join(" ", args);
Set<String> variables = new HashSet<>(localVariables.allVariables()); Set<String> variables = new HashSet<>(localVariables.allVariables());
variables.addAll(Constants.allVariables()); variables.addAll(Constants.allVariables());
variables.addAll(globalVariables.allVariables()); variables.addAll(globalVariables.allVariables());