|
27 | 27 | import com.google.inject.Key;
|
28 | 28 | import com.google.inject.TypeLiteral;
|
29 | 29 | import com.plotsquared.bukkit.BukkitPlatform;
|
| 30 | +import com.plotsquared.bukkit.commands.BukkitSenderMapper; |
30 | 31 | import com.plotsquared.bukkit.util.BukkitUtil;
|
31 | 32 | import com.plotsquared.core.commands.PlotSquaredCaptionProvider;
|
32 | 33 | import com.plotsquared.core.commands.processing.CommandRequirementPostprocessor;
|
@@ -66,35 +67,30 @@ public CloudModule(final @NonNull BukkitPlatform bukkitPlatform) {
|
66 | 67 |
|
67 | 68 | @Override
|
68 | 69 | protected void configure() {
|
69 |
| - try { |
70 |
| - final PaperCommandManager<PlotPlayer<?>> commandManager = new PaperCommandManager<PlotPlayer<?>>( |
71 |
| - this.bukkitPlatform, |
72 |
| - ExecutionCoordinator.asyncCoordinator(), |
73 |
| - CloudModule::convert, |
74 |
| - CloudModule::convert |
75 |
| - ); |
76 |
| - commandManager.captionRegistry().registerProvider(new PlotSquaredCaptionProvider()); |
77 |
| - if (commandManager.hasCapability(CloudBukkitCapabilities.ASYNCHRONOUS_COMPLETION)) { |
78 |
| - commandManager.registerAsynchronousCompletions(); |
79 |
| - } |
80 |
| - if (commandManager.hasCapability(CloudBukkitCapabilities.NATIVE_BRIGADIER)) { |
81 |
| - commandManager.registerBrigadier(); |
82 |
| - } |
| 70 | + final PaperCommandManager<PlotPlayer<?>> commandManager = new PaperCommandManager<PlotPlayer<?>>( |
| 71 | + this.bukkitPlatform, |
| 72 | + ExecutionCoordinator.asyncCoordinator(), |
| 73 | + new BukkitSenderMapper() |
| 74 | + ); |
| 75 | + commandManager.captionRegistry().registerProvider(new PlotSquaredCaptionProvider()); |
| 76 | + if (commandManager.hasCapability(CloudBukkitCapabilities.ASYNCHRONOUS_COMPLETION)) { |
| 77 | + commandManager.registerAsynchronousCompletions(); |
| 78 | + } |
| 79 | + if (commandManager.hasCapability(CloudBukkitCapabilities.NATIVE_BRIGADIER)) { |
| 80 | + commandManager.registerBrigadier(); |
| 81 | + } |
83 | 82 |
|
84 |
| - final CommandRequirementPostprocessor requirementPostprocessor = new CommandRequirementPostprocessor(); |
85 |
| - commandManager.registerCommandPostProcessor(requirementPostprocessor); |
| 83 | + final CommandRequirementPostprocessor requirementPostprocessor = new CommandRequirementPostprocessor(); |
| 84 | + commandManager.registerCommandPostProcessor(requirementPostprocessor); |
86 | 85 |
|
87 |
| - // TODO(City): Override parsing errors using MM parsing. |
88 |
| - MinecraftExceptionHandler.<PlotPlayer<?>>create(PlotPlayer::getAudience) |
89 |
| - .defaultHandlers() |
90 |
| - .decorator((ctx, component) -> TranslatableCaption.of("core.prefix"). |
91 |
| - toComponent(ctx.context().sender()) |
92 |
| - .append(component)) |
93 |
| - .registerTo(commandManager); |
| 86 | + // TODO(City): Override parsing errors using MM parsing. |
| 87 | + MinecraftExceptionHandler.<PlotPlayer<?>>create(PlotPlayer::getAudience) |
| 88 | + .defaultHandlers() |
| 89 | + .decorator((ctx, component) -> TranslatableCaption.of("core.prefix"). |
| 90 | + toComponent(ctx.context().sender()) |
| 91 | + .append(component)) |
| 92 | + .registerTo(commandManager); |
94 | 93 |
|
95 |
| - bind(Key.get(new TypeLiteral<CommandManager<PlotPlayer<?>>>() {})).toInstance(commandManager); |
96 |
| - } catch (final Exception e) { |
97 |
| - LOGGER.error("Failed to configure command manager", e); |
98 |
| - } |
| 94 | + bind(Key.get(new TypeLiteral<CommandManager<PlotPlayer<?>>>() {})).toInstance(commandManager); |
99 | 95 | }
|
100 | 96 | }
|
0 commit comments