mirror of
https://github.com/kaboomserver/extras.git
synced 2024-11-27 01:45:44 -05:00
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:
parent
820b105327
commit
98df416d89
1 changed files with 25 additions and 24 deletions
|
@ -102,31 +102,32 @@ public final class ServerCommand implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 1; i < arr.length; i++) {
|
for (int i = 1; i < arr.length; i++) {
|
||||||
if ("run".equalsIgnoreCase(arr[i])) {
|
if (!"run".equalsIgnoreCase(arr[i])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (i + 1 == arr.length) {
|
if (i + 1 == arr.length) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (checkExecuteCommand(arr[i + 1])) {
|
if (checkExecuteCommand(arr[i + 1])) {
|
||||||
return "cancel";
|
return "cancel";
|
||||||
} else {
|
}
|
||||||
final String[] executeCommand = Arrays.copyOfRange(
|
final String[] executeCommand = Arrays.copyOfRange(
|
||||||
arr, i + 1, arr.length);
|
arr, i + 1, arr.length);
|
||||||
String result = checkCommand(sender,
|
final String result = checkCommand(sender,
|
||||||
String.join(" ", executeCommand), true, depth + 1);
|
String.join(" ", executeCommand), true, depth + 1);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
} else if (result == "cancel") {
|
||||||
switch (result) {
|
|
||||||
case "cancel":
|
|
||||||
return "cancel";
|
return "cancel";
|
||||||
default:
|
}
|
||||||
String pureExecute = String.join(
|
final String pureExecute = String.join(
|
||||||
" ", Arrays.copyOfRange(arr, 0, i + 1));
|
" ", Arrays.copyOfRange(arr, 0, i + 1));
|
||||||
return checkCommand(sender, pureExecute + " " + result,
|
final String finalResult = checkCommand(sender,
|
||||||
isConsoleCommand, depth + 1);
|
pureExecute + " " + result, isConsoleCommand, depth + 1);
|
||||||
}
|
if (finalResult == null) {
|
||||||
}
|
return pureExecute + " " + result;
|
||||||
}
|
}
|
||||||
|
return finalResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue