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