1
0
Files
aetheria-anarchy-plugin/src/main/java/cc/fascinated/command/CommandManager.java
2024-03-28 15:12:18 +00:00

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);
}
}