diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptExecutor.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptExecutor.java index cc85ba3a..9a13e08d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptExecutor.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptExecutor.java @@ -68,7 +68,7 @@ public final class ScriptExecutor { return; } - String[] strings = generateStringArray(command); + String[] strings = replaceVariables(command); if (strings.length == 0) { return; } @@ -99,12 +99,8 @@ public final class ScriptExecutor { } } - private String[] generateStringArray(String command) { - return replaceVariables(command.replaceAll(" +", " ").split(" ")); - } - - private String[] replaceVariables(String[] args) { - String s = String.join(" ", args); + private String[] replaceVariables(String s) { + s = s.replaceAll(" +", " "); Set variables = new HashSet<>(localVariables.allVariables()); variables.addAll(Constants.allVariables()); variables.addAll(globalVariables.allVariables());