Search in sources :

Example 1 with DelegatingCommandDispatcher

use of org.spongepowered.common.command.brigadier.dispatcher.DelegatingCommandDispatcher in project SpongeCommon by SpongePowered.

the class CommandsMixin method impl$useSpongeDispatcher.

// We prepare our own dispatcher and commands manager, to redirect registrations to our system
@Redirect(method = "<init>", at = @At(value = "NEW", args = "class=com/mojang/brigadier/CommandDispatcher", remap = false))
private CommandDispatcher<CommandSourceStack> impl$useSpongeDispatcher() {
    final SpongeCommandManager manager = Launch.instance().lifecycle().platformInjector().getInstance(SpongeCommandManager.class);
    manager.init();
    this.impl$commandManager = manager;
    return new DelegatingCommandDispatcher(manager.getBrigadierRegistrar());
}
Also used : SpongeCommandManager(org.spongepowered.common.command.manager.SpongeCommandManager) DelegatingCommandDispatcher(org.spongepowered.common.command.brigadier.dispatcher.DelegatingCommandDispatcher) Redirect(org.spongepowered.asm.mixin.injection.Redirect)

Aggregations

Redirect (org.spongepowered.asm.mixin.injection.Redirect)1 DelegatingCommandDispatcher (org.spongepowered.common.command.brigadier.dispatcher.DelegatingCommandDispatcher)1 SpongeCommandManager (org.spongepowered.common.command.manager.SpongeCommandManager)1