feat(cmd): remove unused tabcompleter
This commit is contained in:
parent
0d83976d02
commit
a0e8b2c1e6
3 changed files with 2 additions and 39 deletions
|
@ -5,7 +5,6 @@ import de.studiocode.invui.item.builder.ItemBuilder;
|
||||||
import de.studiocode.invui.item.impl.SimpleItem;
|
import de.studiocode.invui.item.impl.SimpleItem;
|
||||||
import net.artelnatif.nicko.bungee.NickoBungee;
|
import net.artelnatif.nicko.bungee.NickoBungee;
|
||||||
import net.artelnatif.nicko.command.NickoCommand;
|
import net.artelnatif.nicko.command.NickoCommand;
|
||||||
import net.artelnatif.nicko.command.NickoTabCompleter;
|
|
||||||
import net.artelnatif.nicko.config.NickoConfiguration;
|
import net.artelnatif.nicko.config.NickoConfiguration;
|
||||||
import net.artelnatif.nicko.event.PlayerJoinListener;
|
import net.artelnatif.nicko.event.PlayerJoinListener;
|
||||||
import net.artelnatif.nicko.event.PlayerQuitListener;
|
import net.artelnatif.nicko.event.PlayerQuitListener;
|
||||||
|
@ -54,7 +53,6 @@ public class NickoBukkit extends JavaPlugin {
|
||||||
final PluginCommand command = getCommand("nicko");
|
final PluginCommand command = getCommand("nicko");
|
||||||
if (command != null) {
|
if (command != null) {
|
||||||
command.setExecutor(new NickoCommand());
|
command.setExecutor(new NickoCommand());
|
||||||
command.setTabCompleter(new NickoTabCompleter());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getServer().getPluginManager().registerEvents(new PlayerJoinListener(), this);
|
getServer().getPluginManager().registerEvents(new PlayerJoinListener(), this);
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class NickoCommand implements CommandExecutor {
|
||||||
switch (args[0]) {
|
switch (args[0]) {
|
||||||
case "debug" -> new NickoDebugSubCmd().execute(sender, args);
|
case "debug" -> new NickoDebugSubCmd().execute(sender, args);
|
||||||
case "check" -> new NickoCheckSubCmd().execute(player, args);
|
case "check" -> new NickoCheckSubCmd().execute(player, args);
|
||||||
default -> sendHelpMessages(sender);
|
default -> sendHelpMessage(sender);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -36,16 +36,8 @@ public class NickoCommand implements CommandExecutor {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendHelpMessages(CommandSender sender) {
|
public void sendHelpMessage(CommandSender sender) {
|
||||||
helpMessage = helpMessage.replace("{version}", NickoBukkit.getInstance().getDescription().getVersion());
|
helpMessage = helpMessage.replace("{version}", NickoBukkit.getInstance().getDescription().getVersion());
|
||||||
sender.sendMessage(helpMessage);
|
sender.sendMessage(helpMessage);
|
||||||
if (sender.isOp()) {
|
|
||||||
final String adminHelpMessage = """
|
|
||||||
§c(OP) §6/nicko disguise §b<player> §f- §7Change specified player's appearance.
|
|
||||||
§c(OP) §6/nicko revert §b<player> §f- §7Revert specified player's appearance to their default skin and name.
|
|
||||||
§c(OP) §6/nicko check §b<player> §f- §7Print detailed information about specified player's appearance.
|
|
||||||
""";
|
|
||||||
sender.sendMessage(adminHelpMessage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
package net.artelnatif.nicko.command;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.command.TabCompleter;
|
|
||||||
import org.bukkit.entity.HumanEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class NickoTabCompleter implements TabCompleter {
|
|
||||||
@Override
|
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
|
|
||||||
if (sender instanceof Player) {
|
|
||||||
if (args.length == 1) {
|
|
||||||
return List.of("help", "check");
|
|
||||||
} else if (args.length >= 2 && !args[0].equalsIgnoreCase("help")) {
|
|
||||||
return Bukkit.getOnlinePlayers().stream().map(HumanEntity::getName).toList();
|
|
||||||
} else {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue