From 5adbc0f1e71cfdb4acebbd21535c2acd3b6baef3 Mon Sep 17 00:00:00 2001 From: ajgeiss0702 Date: Mon, 28 Feb 2022 11:06:00 -0700 Subject: [PATCH] add slash-server aliases --- .../SlashServer/SlashServerCommand.java | 9 ++++++++- .../queue/common/SlashServerManager.java | 18 ++++++++++++++---- common/src/main/resources/config.yml | 6 +++++- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/common/src/main/java/us/ajg0702/queue/commands/commands/SlashServer/SlashServerCommand.java b/common/src/main/java/us/ajg0702/queue/commands/commands/SlashServer/SlashServerCommand.java index 8d4dbc6..c43a8d0 100644 --- a/common/src/main/java/us/ajg0702/queue/commands/commands/SlashServer/SlashServerCommand.java +++ b/common/src/main/java/us/ajg0702/queue/commands/commands/SlashServer/SlashServerCommand.java @@ -14,14 +14,21 @@ public class SlashServerCommand extends BaseCommand { final QueueMain main; final String server; + final String command; public SlashServerCommand(QueueMain main, String server) { this.main = main; this.server = server; + this.command = server; + } + public SlashServerCommand(QueueMain main, String command, String server) { + this.main = main; + this.server = server; + this.command = command; } @Override public String getName() { - return server; + return command; } @Override diff --git a/common/src/main/java/us/ajg0702/queue/common/SlashServerManager.java b/common/src/main/java/us/ajg0702/queue/common/SlashServerManager.java index 584e92a..b29bebf 100644 --- a/common/src/main/java/us/ajg0702/queue/common/SlashServerManager.java +++ b/common/src/main/java/us/ajg0702/queue/common/SlashServerManager.java @@ -22,10 +22,20 @@ public class SlashServerManager { serverCommands.clear(); List slashServerServers = main.getConfig().getStringList("slash-servers"); - for(String server : slashServerServers) { - SlashServerCommand command = new SlashServerCommand(main, server); - serverCommands.add(command); - implementation.registerCommand(command); + for(String rawServer : slashServerServers) { + if(rawServer.contains(":") && main.isPremium()) { + String[] parts = rawServer.split(":"); + String command = parts[0]; + String server = parts[1]; + SlashServerCommand slashServerCommand = new SlashServerCommand(main, command, server); + serverCommands.add(slashServerCommand); + implementation.registerCommand(slashServerCommand); + } else { + SlashServerCommand command = new SlashServerCommand(main, rawServer); + serverCommands.add(command); + implementation.registerCommand(command); + } + } } } diff --git a/common/src/main/resources/config.yml b/common/src/main/resources/config.yml index 9153d00..07dd3f7 100644 --- a/common/src/main/resources/config.yml +++ b/common/src/main/resources/config.yml @@ -1,5 +1,5 @@ # Dont touch this number please -config-version: 33 +config-version: 34 # This is the main config for ajQueue. @@ -274,6 +274,10 @@ enable-updater: true # For example, if survival is in this list, then if a player executes /survival # then they will be put in the queue for survival # This works for both servers and groups +# If you have ajQueuePlus, you can also make aliases. +# For example, if you have a server called lobby, and you want people to be able to use /hub, you can use this: +# - "hub:lobby" +# If you have the free version, you can only put the server name, no aliases. slash-servers: [] # What balancer should we use?