add slash-server aliases

This commit is contained in:
ajgeiss0702
2022-02-28 11:06:00 -07:00
parent c3bea940a5
commit 5adbc0f1e7
3 changed files with 27 additions and 6 deletions
@@ -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
@@ -22,10 +22,20 @@ public class SlashServerManager {
serverCommands.clear();
List<String> 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);
}
}
}
}
+5 -1
View File
@@ -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?