Fix /execute command blocker bug (#337)

Fixes a bug where commands in /execute would not have modifications applied to them.
Example: `/execute run particle flame ~ ~ ~ 1 1 1 0 100 force @s` would not get modified before this PR, but now it gets modified to `/execute run particle flame ~ ~ ~ 1 1 1 0 10 force @s`
This commit is contained in:
Luna 2023-02-25 13:45:50 -03:00 committed by GitHub
parent 820b105327
commit 98df416d89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -102,31 +102,32 @@ public final class ServerCommand implements Listener {
}
for (int i = 1; i < arr.length; i++) {
if ("run".equalsIgnoreCase(arr[i])) {
if (!"run".equalsIgnoreCase(arr[i])) {
continue;
}
if (i + 1 == arr.length) {
break;
}
if (checkExecuteCommand(arr[i + 1])) {
return "cancel";
} else {
}
final String[] executeCommand = Arrays.copyOfRange(
arr, i + 1, arr.length);
String result = checkCommand(sender,
final String result = checkCommand(sender,
String.join(" ", executeCommand), true, depth + 1);
if (result == null) {
continue;
}
switch (result) {
case "cancel":
} else if (result == "cancel") {
return "cancel";
default:
String pureExecute = String.join(
}
final String pureExecute = String.join(
" ", Arrays.copyOfRange(arr, 0, i + 1));
return checkCommand(sender, pureExecute + " " + result,
isConsoleCommand, depth + 1);
}
}
final String finalResult = checkCommand(sender,
pureExecute + " " + result, isConsoleCommand, depth + 1);
if (finalResult == null) {
return pureExecute + " " + result;
}
return finalResult;
}
}
break;