add slash-server aliases
This commit is contained in:
+8
-1
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user