private void registerCommands() {
int amount = 0;
final String packet = getClass().getPackageName();
for (Class<? extends CustomCommand> clazz : new Reflections(
packet + ".command").getSubTypesOf(CustomCommand.class)
) {
try {
final CustomCommand command = clazz.getDeclaredConstructor().newInstance();
this.getServer().getCommandMap().register(
command.getLabel(), this.getName(), command);
amount += 1;
} catch (NoSuchMethodException | InvocationTargetException
| InstantiationException | IllegalAccessException exception
) {
this.getSLF4JLogger().error("[{}] Failed to load commands.",
exception.getClass().getName(), exception
);
this.getServer().getPluginManager().disablePlugin(this);
}
} this.getSLF4JLogger().info("Successfully loaded {} commands.", amount);
}
forked from ImFoxter/custom-command
-
Notifications
You must be signed in to change notification settings - Fork 0
sxnsh1ness/custom-command
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Java 100.0%