/queue command tab complete

This commit is contained in:
ajgeiss0702
2020-08-09 07:21:55 -07:00
parent b15bea7bb1
commit 4d6fa69b30
3 changed files with 22 additions and 3 deletions
@@ -1,13 +1,16 @@
package us.ajg0702.queue.commands; package us.ajg0702.queue.commands;
import java.util.ArrayList;
import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Command; 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.Main;
import us.ajg0702.queue.Manager; import us.ajg0702.queue.Manager;
import us.ajg0702.utils.bungee.BungeeMessages; import us.ajg0702.utils.bungee.BungeeMessages;
public class MoveCommand extends Command { public class MoveCommand extends Command implements TabExecutor {
Main plugin; Main plugin;
BungeeMessages msgs; BungeeMessages msgs;
public MoveCommand(Main pl) { public MoveCommand(Main pl) {
@@ -39,4 +42,15 @@ public class MoveCommand extends Command {
}*/ }*/
} }
} }
@Override
public Iterable<String> 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;
}
} }
@@ -26,7 +26,7 @@ public class Commands implements CommandExecutor {
String srvname = args[0]; String srvname = args[0];
if(args.length > 1) { if(args.length > 1) {
pl.getLogger().info("sending player to queue"); pl.getLogger().info("Sending "+args[0]+" to queue");
if(!sender.hasPermission("ajqueue.send")) { if(!sender.hasPermission("ajqueue.send")) {
sender.sendMessage(color("&cYou do not have permission to do this!")); sender.sendMessage(color("&cYou do not have permission to do this!"));
return true; return true;
+6 -1
View File
@@ -1,5 +1,5 @@
# Dont touch this number please # Dont touch this number please
config-version: 14 config-version: 15
# The time the server will wait between sending people in the queue # The time the server will wait between sending people in the queue
# Default: 5 # Default: 5
@@ -118,3 +118,8 @@ joinfrom-server-permission: false
# Format: "groupname:server1,server2,etc" # Format: "groupname:server1,server2,etc"
server-groups: server-groups:
- "lobbys:lobby-1,lobby-2,lobby-3" - "lobbys:lobby-1,lobby-2,lobby-3"
# Should we allow tab-completing in the /queue command?
# Default: true
tab-complete-queues: true