30 lines
1016 B
Java
30 lines
1016 B
Java
package cc.fascinated.command;
|
|
|
|
import cc.fascinated.Aetheria;
|
|
import cc.fascinated.command.impl.HelpCommand;
|
|
import cc.fascinated.command.impl.SeedCommand;
|
|
import cc.fascinated.command.impl.TotalJoinsCommand;
|
|
import cc.fascinated.command.impl.VoteCommand;
|
|
import org.bukkit.command.PluginCommand;
|
|
|
|
public class CommandManager {
|
|
|
|
public CommandManager() {
|
|
registerCommand(new TotalJoinsCommand());
|
|
registerCommand(new HelpCommand());
|
|
registerCommand(new SeedCommand());
|
|
registerCommand(new VoteCommand());
|
|
}
|
|
|
|
public static void registerCommand(Command command) {
|
|
if (command == null) {
|
|
throw new IllegalArgumentException("Command cannot be null.");
|
|
}
|
|
PluginCommand pluginCommand = Aetheria.INSTANCE.getCommand(command.getCommand());
|
|
if (pluginCommand == null) {
|
|
throw new IllegalArgumentException("Command " + command.getCommand() + " does not exist.");
|
|
}
|
|
pluginCommand.setExecutor(command);
|
|
}
|
|
}
|