Re-use command manager service.

This commit is contained in:
wizjany 2019-05-09 10:28:08 -04:00
parent 31d4daf474
commit c169d8f258

View File

@ -151,6 +151,7 @@ public final class PlatformCommandManager {
private final WorldEdit worldEdit; private final WorldEdit worldEdit;
private final PlatformManager platformManager; private final PlatformManager platformManager;
private final CommandManagerServiceImpl commandManagerService;
private final CommandManager commandManager; private final CommandManager commandManager;
private final InjectedValueStore globalInjectedValues; private final InjectedValueStore globalInjectedValues;
private final DynamicStreamHandler dynamicHandler = new DynamicStreamHandler(); private final DynamicStreamHandler dynamicHandler = new DynamicStreamHandler();
@ -168,7 +169,8 @@ public final class PlatformCommandManager {
this.worldEdit = worldEdit; this.worldEdit = worldEdit;
this.platformManager = platformManager; this.platformManager = platformManager;
this.exceptionConverter = new WorldEditExceptionConverter(worldEdit); this.exceptionConverter = new WorldEditExceptionConverter(worldEdit);
this.commandManager = new CommandManagerServiceImpl().newCommandManager(); this.commandManagerService = new CommandManagerServiceImpl();
this.commandManager = commandManagerService.newCommandManager();
this.globalInjectedValues = MapBackedValueStore.create(); this.globalInjectedValues = MapBackedValueStore.create();
this.registration = new CommandRegistrationHandler( this.registration = new CommandRegistrationHandler(
ImmutableList.of( ImmutableList.of(
@ -253,8 +255,7 @@ public final class PlatformCommandManager {
cmd.description(TextComponent.of(desc)); cmd.description(TextComponent.of(desc));
cmd.action(Command.Action.NULL_ACTION); cmd.action(Command.Action.NULL_ACTION);
CommandManager manager = DefaultCommandManagerService.getInstance() CommandManager manager = commandManagerService.newCommandManager();
.newCommandManager();
this.registration.register( this.registration.register(
manager, manager,
registration, registration,