Skip to content

Commit

Permalink
Fix SpigotCommand tab complete not being called
Browse files Browse the repository at this point in the history
  • Loading branch information
xDec0de committed Nov 2, 2024
1 parent cb9b94e commit b7de8e3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,10 @@ public void registerCommands(SpigotCommand<P>... commands) {
final List<Command> remaining = new ArrayList<>();
for (SpigotCommand<P> command : commands) {
final PluginCommand plCommand = getPlugin().getCommand(command.getName());
if (plCommand != null)
if (plCommand != null) {
plCommand.setExecutor(command);
else
plCommand.setTabCompleter(command);
} else
remaining.add(command);
}
if (remaining.isEmpty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.annotation.Nonnull;

import java.util.Arrays;
import java.util.List;

Expand Down Expand Up @@ -63,9 +65,15 @@ public final boolean execute(@NotNull CommandSender sender, @NotNull String comm
return subCommandHandler.onCommand(this, new SpigotCommandSender(sender, getUtils()), args);
}

@NotNull
@Override
@Nullable
public final List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
return tabComplete(sender, label, args);
}

@NotNull
@Override
public final List<String> tabComplete(@Nonnull CommandSender sender, @Nonnull String alias, @Nonnull String[] args) {
return subCommandHandler.onTab(this, new SpigotCommandSender(sender, getUtils()), args);
}

Expand Down

0 comments on commit b7de8e3

Please sign in to comment.