use of com.freya02.botcommands.internal.prefixed.HelpCommand in project BotCommands by freya022.
the class CommandsBuilderImpl method buildClasses.
private void buildClasses() throws Exception {
classes.removeIf(c -> {
try {
return !ReflectionUtils.isInstantiable(c);
} catch (IllegalAccessException | InvocationTargetException e) {
LOGGER.error("An error occurred while trying to find if a class is instantiable", e);
throw new RuntimeException("An error occurred while trying to find if a class is instantiable", e);
}
});
for (Class<?> aClass : classes) {
processClass(aClass);
}
if (!context.isHelpDisabled()) {
processClass(HelpCommand.class);
final TextCommandInfo helpInfo = context.findFirstCommand(CommandPath.of("help"));
if (helpInfo == null)
throw new IllegalStateException("HelpCommand did not build properly");
final HelpCommand help = (HelpCommand) helpInfo.getInstance();
help.generate();
}
prefixedCommandsBuilder.postProcess();
if (context.getComponentManager() != null) {
// Load button listeners
for (Class<?> aClass : classes) {
componentsBuilder.processClass(aClass);
}
} else {
LOGGER.info("ComponentManager is not set, the Components API, paginators and menus won't be usable");
}
applicationCommandsBuilder.postProcess();
if (context.getComponentManager() != null) {
componentsBuilder.postProcess();
}
eventListenersBuilder.postProcess();
autocompletionHandlersBuilder.postProcess();
context.getRegistrationListeners().forEach(RegistrationListener::onBuildComplete);
LOGGER.info("Finished registering all commands");
}
Aggregations