Skip to content

Commit

Permalink
fix bug with parsing commands that contain a colon
Browse files Browse the repository at this point in the history
  • Loading branch information
Revxrsal committed Nov 10, 2023
1 parent 1f43ddd commit 98d75dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ public void action(Command<?> command) {

public Node canBeExecuted(BukkitBrigadier brigadier) {
action(a -> {
String input = stripNamespace(a.getInput());
String input = a.getInput();
ArgumentStack args = ArgumentStack.parse(
input.startsWith("/") ? input.substring(1) : input
input.indexOf('/') == 0 ? input.substring(1) : input
);
args.set(0, stripNamespace(args.getFirst()));

CommandActor actor = brigadier.wrapSource(a.getSource());
try {
brigadier.getCommandHandler().dispatch(actor, args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ public final class UnknownCommandListener implements Listener {

@EventHandler
public void onUnknownCommand(UnknownCommandEvent event) {
ArgumentStack args = ArgumentStack.parse(
stripNamespace(fallbackPrefix, event.getCommandLine())
);
ArgumentStack args = ArgumentStack.parse(event.getCommandLine());
args.set(0, stripNamespace(fallbackPrefix, args.getFirst()));
if (commands.containsKey(args.getFirst())) {
event.message(null);
BukkitCommandActor actor = BukkitCommandActor.wrap(event.getSender(), handler);
Expand Down

0 comments on commit 98d75dc

Please sign in to comment.