From 4d6fa69b305c6bc3e672c98449bbaabfc1be7df4 Mon Sep 17 00:00:00 2001 From: ajgeiss0702 Date: Sun, 9 Aug 2020 07:21:55 -0700 Subject: [PATCH] /queue command tab complete --- .../us/ajg0702/queue/commands/MoveCommand.java | 16 +++++++++++++++- .../java/us/ajg0702/queue/spigot/Commands.java | 2 +- src/main/resources/config.yml | 7 ++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/main/java/us/ajg0702/queue/commands/MoveCommand.java b/src/main/java/us/ajg0702/queue/commands/MoveCommand.java index f20ac20..e5c46c4 100644 --- a/src/main/java/us/ajg0702/queue/commands/MoveCommand.java +++ b/src/main/java/us/ajg0702/queue/commands/MoveCommand.java @@ -1,13 +1,16 @@ package us.ajg0702.queue.commands; +import java.util.ArrayList; + import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.plugin.Command; +import net.md_5.bungee.api.plugin.TabExecutor; import us.ajg0702.queue.Main; import us.ajg0702.queue.Manager; import us.ajg0702.utils.bungee.BungeeMessages; -public class MoveCommand extends Command { +public class MoveCommand extends Command implements TabExecutor { Main plugin; BungeeMessages msgs; public MoveCommand(Main pl) { @@ -39,4 +42,15 @@ public class MoveCommand extends Command { }*/ } } + + @Override + public Iterable onTabComplete(CommandSender sender, String[] args) { + if(!plugin.getConfig().getBoolean("tab-complete-queues")) { + return new ArrayList<>(); + } + if(args.length == 1) { + return Manager.getInstance().getServerNames(); + } + return null; + } } diff --git a/src/main/java/us/ajg0702/queue/spigot/Commands.java b/src/main/java/us/ajg0702/queue/spigot/Commands.java index 10585b0..fa0ab61 100644 --- a/src/main/java/us/ajg0702/queue/spigot/Commands.java +++ b/src/main/java/us/ajg0702/queue/spigot/Commands.java @@ -26,7 +26,7 @@ public class Commands implements CommandExecutor { String srvname = args[0]; if(args.length > 1) { - pl.getLogger().info("sending player to queue"); + pl.getLogger().info("Sending "+args[0]+" to queue"); if(!sender.hasPermission("ajqueue.send")) { sender.sendMessage(color("&cYou do not have permission to do this!")); return true; diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 7a840b1..c0d8d2d 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,5 +1,5 @@ # Dont touch this number please -config-version: 14 +config-version: 15 # The time the server will wait between sending people in the queue # Default: 5 @@ -118,3 +118,8 @@ joinfrom-server-permission: false # Format: "groupname:server1,server2,etc" server-groups: - "lobbys:lobby-1,lobby-2,lobby-3" + + +# Should we allow tab-completing in the /queue command? +# Default: true +tab-complete-queues: true