Fixed commands not working

This commit is contained in:
MattBDev 2020-02-06 15:34:22 -05:00
parent 490e200a70
commit 0b5eb903b6

View File

@ -616,7 +616,12 @@ public final class PlatformCommandManager {
public void handleCommand(CommandEvent event) { public void handleCommand(CommandEvent event) {
Request.reset(); Request.reset();
Actor actor = event.getActor(); Actor actor = event.getActor();
String args = event.getArguments(); String args;
if (event.getArguments().length() > 1) {
args = event.getArguments().substring(1);
} else {
args = event.getArguments();
}
TaskManager.IMP.taskNow(() -> { TaskManager.IMP.taskNow(() -> {
int space0 = args.indexOf(' '); int space0 = args.indexOf(' ');
String arg0 = space0 == -1 ? args : args.substring(0, space0); String arg0 = space0 == -1 ? args : args.substring(0, space0);
@ -689,11 +694,12 @@ public final class PlatformCommandManager {
exceptionConverter.convert(next); exceptionConverter.convert(next);
next = next.getCause(); next = next.getCause();
} while (next != null); } while (next != null);
throw t; throw t;
} }
} catch (ConditionFailedException e) { } catch (ConditionFailedException e) {
if (e.getCondition() instanceof PermissionCondition) { if (e.getCondition() instanceof PermissionCondition) {
actor.printError(Caption.of("fawe.error.no.perm", StringMan.getString(((PermissionCondition) e.getCondition()).getPermissions()))); actor.printError(TranslatableComponent.of("worldedit.command.permissions"));
} else { } else {
actor.print(e.getRichMessage()); actor.print(e.getRichMessage());
} }
@ -819,6 +825,7 @@ public final class PlatformCommandManager {
} }
throw t; throw t;
} }
event.setSuggestions(suggestions.stream() event.setSuggestions(suggestions.stream()
.map(suggestion -> { .map(suggestion -> {
int noSlashLength = arguments.length() - 1; int noSlashLength = arguments.length() - 1;