1
0
Files
aetheria-anarchy-plugin/src/main/java/cc/fascinated/command/CommandManager.java

30 lines
1016 B
Java
Raw Normal View History

2024-03-20 13:42:42 +00:00
package cc.fascinated.command;
import cc.fascinated.Aetheria;
2024-03-20 17:50:17 +00:00
import cc.fascinated.command.impl.HelpCommand;
2024-03-28 14:00:15 +00:00
import cc.fascinated.command.impl.SeedCommand;
2024-03-20 13:42:42 +00:00
import cc.fascinated.command.impl.TotalJoinsCommand;
2024-03-28 15:12:18 +00:00
import cc.fascinated.command.impl.VoteCommand;
2024-03-28 14:00:15 +00:00
import org.bukkit.command.PluginCommand;
2024-03-20 13:42:42 +00:00
public class CommandManager {
public CommandManager() {
registerCommand(new TotalJoinsCommand());
2024-03-20 17:50:17 +00:00
registerCommand(new HelpCommand());
2024-03-28 14:00:15 +00:00
registerCommand(new SeedCommand());
2024-03-28 15:12:18 +00:00
registerCommand(new VoteCommand());
2024-03-20 13:42:42 +00:00
}
public static void registerCommand(Command command) {
if (command == null) {
throw new IllegalArgumentException("Command cannot be null.");
}
2024-03-28 14:00:15 +00:00
PluginCommand pluginCommand = Aetheria.INSTANCE.getCommand(command.getCommand());
if (pluginCommand == null) {
throw new IllegalArgumentException("Command " + command.getCommand() + " does not exist.");
}
pluginCommand.setExecutor(command);
2024-03-20 13:42:42 +00:00
}
}