fix brigadier suggestions with the '/execute' command, fix running cloud commands with '/execute' on fabric
This commit is contained in:
parent
8db87744d9
commit
f16cafda3f
2 changed files with 6 additions and 8 deletions
|
|
@ -617,8 +617,12 @@ public final class CloudBrigadierManager<C, S> {
|
||||||
final @NonNull SuggestionsBuilder builder
|
final @NonNull SuggestionsBuilder builder
|
||||||
) {
|
) {
|
||||||
final CommandContext<C> commandContext;
|
final CommandContext<C> commandContext;
|
||||||
|
String command = builder.getInput();
|
||||||
if (this.brigadierCommandSenderMapper == null || senderContext == null) {
|
if (this.brigadierCommandSenderMapper == null || senderContext == null) {
|
||||||
commandContext = this.dummyContextProvider.get();
|
commandContext = this.dummyContextProvider.get();
|
||||||
|
if (command.startsWith("/") /* Minecraft specific */) {
|
||||||
|
command = command.substring(1);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
final C cloudSender = this.brigadierCommandSenderMapper.apply(senderContext.getSource());
|
final C cloudSender = this.brigadierCommandSenderMapper.apply(senderContext.getSource());
|
||||||
commandContext = new CommandContext<>(
|
commandContext = new CommandContext<>(
|
||||||
|
|
@ -626,11 +630,7 @@ public final class CloudBrigadierManager<C, S> {
|
||||||
cloudSender,
|
cloudSender,
|
||||||
this.commandManager
|
this.commandManager
|
||||||
);
|
);
|
||||||
}
|
command = command.substring(senderContext.getLastChild().getNodes().get(0).getRange().getStart());
|
||||||
|
|
||||||
String command = builder.getInput();
|
|
||||||
if (command.startsWith("/") /* Minecraft specific */) {
|
|
||||||
command = command.substring(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove namespace */
|
/* Remove namespace */
|
||||||
|
|
|
||||||
|
|
@ -79,9 +79,7 @@ final class FabricExecutor<C, S extends CommandSource> implements Command<S> {
|
||||||
@Override
|
@Override
|
||||||
public int run(final @NonNull CommandContext<S> ctx) {
|
public int run(final @NonNull CommandContext<S> ctx) {
|
||||||
final S source = ctx.getSource();
|
final S source = ctx.getSource();
|
||||||
final String input = ctx.getInput().startsWith("/")
|
final String input = ctx.getInput().substring(ctx.getLastChild().getNodes().get(0).getRange().getStart());
|
||||||
? ctx.getInput().substring(1)
|
|
||||||
: ctx.getInput();
|
|
||||||
final C sender = this.manager.getCommandSourceMapper().apply(source);
|
final C sender = this.manager.getCommandSourceMapper().apply(source);
|
||||||
this.manager.executeCommand(sender, input).whenComplete(this.getResultConsumer(source, sender));
|
this.manager.executeCommand(sender, input).whenComplete(this.getResultConsumer(source, sender));
|
||||||
return com.mojang.brigadier.Command.SINGLE_SUCCESS;
|
return com.mojang.brigadier.Command.SINGLE_SUCCESS;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue