use of cloud.commandframework.velocity.CloudInjectionModule in project Floodgate by GeyserMC.
the class VelocityPlatformModule method configure.
@Override
protected void configure() {
VelocityCommandUtil commandUtil = new VelocityCommandUtil();
requestInjection(commandUtil);
bind(CommandUtil.class).to(VelocityCommandUtil.class);
bind(VelocityCommandUtil.class).toInstance(commandUtil);
Injector child = guice.createChildInjector(new CloudInjectionModule<>(UserAudience.class, CommandExecutionCoordinator.simpleCoordinator(), commandUtil::getAudience, audience -> (CommandSource) audience.source()));
CommandManager<UserAudience> commandManager = child.getInstance(new Key<VelocityCommandManager<UserAudience>>() {
});
bind(new Key<CommandManager<UserAudience>>() {
}).toInstance(commandManager);
commandManager.registerCommandPreProcessor(new FloodgateCommandPreprocessor<>(commandUtil));
}
use of cloud.commandframework.velocity.CloudInjectionModule 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());
}
Aggregations