Search in sources :

Example 1 with CloudSuggestionProcessor

use of com.oskarsmc.message.util.CloudSuggestionProcessor in project message by OskarsMC-Plugins.

the class Message method onProxyInitialization.

/**
 * Initialise the plugin.
 * @param event Proxy Initialise Event
 */
@Subscribe
public void onProxyInitialization(ProxyInitializeEvent event) {
    MessageSettings messageSettings = injector.getInstance(MessageSettings.class);
    injector = injector.createChildInjector(new CloudInjectionModule<>(CommandSource.class, CommandExecutionCoordinator.simpleCoordinator(), Function.identity(), Function.identity()), new MessageModule(messageSettings));
    injector.getInstance(TranslationManager.class);
    if (messageSettings.enabled()) {
        if (messageSettings.luckpermsIntegration()) {
            if (DependencyChecker.luckperms()) {
                logger.info("LuckPerms integration enabled. Targeted LuckPerms version 5.3, using " + LuckPermsProvider.get().getPluginMetadata().getVersion());
            } else {
                logger.warn("LuckPerms integration was enabled but LuckPerms was not detected on the proxy. Continuing without it.");
                messageSettings.luckpermsIntegration(false);
            }
        }
        // Allow autocompletion regardless of capitalisation
        injector.getInstance(Key.get(new TypeLiteral<VelocityCommandManager<CommandSource>>() {
        })).setCommandSuggestionProcessor(new CloudSuggestionProcessor());
        // Commands
        injector.getInstance(MessageCommand.class);
        injector.getInstance(SocialSpyCommand.class);
        injector.getInstance(ReplyCommand.class);
        // Metrics
        injector.getInstance(MessageMetrics.class);
    }
    logger.info("Loaded message " + getClass().getPackage().getImplementationVersion());
}
Also used : CloudSuggestionProcessor(com.oskarsmc.message.util.CloudSuggestionProcessor) MessageSettings(com.oskarsmc.message.configuration.MessageSettings) MessageModule(com.oskarsmc.message.util.MessageModule) CloudInjectionModule(cloud.commandframework.velocity.CloudInjectionModule) VelocityCommandManager(cloud.commandframework.velocity.VelocityCommandManager) Subscribe(com.velocitypowered.api.event.Subscribe)

Aggregations

CloudInjectionModule (cloud.commandframework.velocity.CloudInjectionModule)1 VelocityCommandManager (cloud.commandframework.velocity.VelocityCommandManager)1 MessageSettings (com.oskarsmc.message.configuration.MessageSettings)1 CloudSuggestionProcessor (com.oskarsmc.message.util.CloudSuggestionProcessor)1 MessageModule (com.oskarsmc.message.util.MessageModule)1 Subscribe (com.velocitypowered.api.event.Subscribe)1