Fix TAB completion for console

This commit is contained in:
William committed 2022-08-23 17:27:10 +01:00
1 parent 6d6863c55b
commit 91dd3b5470
2 files changed
+2 -4

No files matched your search

@@ -67,7 +67,7 @@ public class BukkitCommand implements CommandExecutor, TabExecutor {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command,
@NotNull String alias, @NotNull String[] args) { @NotNull String alias, @NotNull String[] args) {
if (this.command instanceof TabCompletable tabCompletable) { if (this.command instanceof TabCompletable tabCompletable) {
return tabCompletable.onTabComplete(BukkitPlayer.adapt((Player) sender), args); return tabCompletable.onTabComplete(args);
} }
return Collections.emptyList(); return Collections.emptyList();
} }
@@ -1,6 +1,5 @@
package net.william278.huskhomes.command; package net.william278.huskhomes.command;
import net.william278.huskhomes.player.OnlineUser;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.List; import java.util.List;
@@ -13,11 +12,10 @@ public interface TabCompletable {
/** /**
* What should be returned when the player attempts to TAB-complete the command * What should be returned when the player attempts to TAB-complete the command
* *
* @param onlineUser {@link OnlineUser} doing the TAB completion
* @param args Current command arguments * @param args Current command arguments
* @return List of String arguments to offer TAB suggestions * @return List of String arguments to offer TAB suggestions
*/ */
@NotNull @NotNull
List<String> onTabComplete(@NotNull OnlineUser onlineUser, @NotNull String[] args); List<String> onTabComplete(@NotNull String[] args);
} }