fix tab completion

This commit is contained in:
2024-01-20 14:47:23 -06:00
parent 86358e49b8
commit d2b524c259
16 changed files with 171 additions and 24 deletions
@@ -1,5 +1,6 @@
package dev.plex.extras.command;
import com.google.common.collect.ImmutableList;
import dev.plex.cache.DataUtils;
import dev.plex.command.PlexCommand;
import dev.plex.command.annotation.CommandParameters;
@@ -7,6 +8,7 @@ import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.exception.PlayerNotFoundException;
import dev.plex.extras.TFMExtras;
import dev.plex.player.PlexPlayer;
import dev.plex.util.PlexUtils;
import java.util.List;
import net.kyori.adventure.text.Component;
import org.bukkit.command.CommandSender;
@@ -52,4 +54,10 @@ public class AutoTeleportCommand extends PlexCommand
isEnabled = !isEnabled;
return messageComponent("modifiedAutoTeleport", target.getName(), isEnabled ? "now" : "no longer");
}
@Override
public @NotNull List<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
{
return args.length == 1 && silentCheckPermission(sender, this.getPermission()) ? PlexUtils.getPlayerNameList() : ImmutableList.of();
}
}