Package org.incendo.cloud.bukkit
Class BukkitCommandManager<C>
java.lang.Object
org.incendo.cloud.CommandManager<C>
org.incendo.cloud.bukkit.BukkitCommandManager<C>
- Type Parameters:
C- command sender type
- All Implemented Interfaces:
BrigadierManagerHolder<C,,Object> PluginHolder,CommandBuilderSource<C>,SenderMapperHolder<CommandSender,,C> Stateful<RegistrationState>
public abstract class BukkitCommandManager<C>
extends CommandManager<C>
implements BrigadierManagerHolder<C,Object>, SenderMapperHolder<CommandSender,C>, PluginHolder
Base
CommandManager implementation for Bukkit-based platforms.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classException thrown when Brigadier mappings fail to initialize.static final classException thrown when the command manager could not be initialized.Nested classes/interfaces inherited from interface org.incendo.cloud.brigadier.BrigadierManagerHolder
BrigadierManagerHolder.BrigadierManagerNotPresent -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBukkitCommandManager(@NonNull Plugin owningPlugin, @NonNull ExecutionCoordinator<C> commandExecutionCoordinator, @NonNull SenderMapper<CommandSender, C> senderMapper) Create a new Bukkit command manager. -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidCheck whether Brigadier can be used on the server instancebooleanfinal booleanhasPermission(@NonNull C sender, @NonNull String permission) Returns the plugin that owns the manager.voidAttempts to enable Brigadier command registration through Commodore.final @NonNull SenderMapper<CommandSender, C> protected final booleanprotected final voidsplitAliases(boolean value) Methods inherited from class org.incendo.cloud.CommandManager
appendSuggestionMapper, capabilities, captionFormatter, captionFormatter, captionRegistry, captionRegistry, command, command, command, commandExecutor, commandRegistrationHandler, commandRegistrationHandler, commands, commandSyntaxFormatter, commandSyntaxFormatter, commandTree, componentBuilder, createDefaultCommandMeta, createHelpHandler, createHelpHandler, decorateBuilder, deleteRootCommand, exceptionController, flagBuilder, hasCapability, helpHandlerFactory, helpHandlerFactory, isCommandRegistrationAllowed, lockRegistration, parameterInjectorRegistry, parserRegistry, postprocessContext, preprocessContext, registerCapability, registerCommandPostProcessor, registerCommandPreProcessor, registerDefaultExceptionHandlers, rootCommands, settings, state, suggestionFactory, suggestionMapper, suggestionMapper, suggestionProcessor, suggestionProcessor, testPermission, transitionIfPossibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.incendo.cloud.CommandBuilderSource
commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilderMethods inherited from interface org.incendo.cloud.state.Stateful
requireState, transitionOrThrow
-
Constructor Details
-
BukkitCommandManager
@API(status=INTERNAL, since="2.0.0") protected BukkitCommandManager(@NonNull Plugin owningPlugin, @NonNull ExecutionCoordinator<C> commandExecutionCoordinator, @NonNull SenderMapper<CommandSender, C> senderMapper) throws BukkitCommandManager.InitializationExceptionCreate a new Bukkit command manager.BukkitCommandManageris not intended to be created and used directly. Instead, usePaperCommandManagerfromcloud-paperwhich extendsBukkitCommandManagerwith specific support for Paper-based platforms, but does not lose support for non Paper-based Bukkit platforms.- Parameters:
owningPlugin- Plugin constructing the manager. Used when registering commands to the command map, registering event listeners, etc.commandExecutionCoordinator- Execution coordinator instance. Due to Bukkit blocking the main thread for suggestion requests, it's potentially unsafe to use anything other thanExecutionCoordinator.nonSchedulingExecutor()forExecutionCoordinator.Builder.suggestionsExecutor(Executor). Once the coordinator, a suggestion provider, parser, or similar routes suggestion logic off of the calling (main) thread, it won't be possible to schedule further logic back to the main thread without a deadlock. When Brigadier support is active, this issue is avoided, as it allows for non-blocking suggestions.senderMapper- Mapper between Bukkit'sCommandSenderand the command sender typeC.- Throws:
BukkitCommandManager.InitializationException- if construction of the manager fails- See Also:
-
-
Method Details
-
owningPlugin
Description copied from interface:PluginHolderReturns the plugin that owns the manager.- Specified by:
owningPluginin interfacePluginHolder- Returns:
- owning plugin
-
senderMapper
- Specified by:
senderMapperin interfaceSenderMapperHolder<CommandSender,C>
-
hasPermission
- Specified by:
hasPermissionin classCommandManager<C>
-
splitAliases
-
splitAliases
-
checkBrigadierCompatibility
protected final void checkBrigadierCompatibility() throws BukkitCommandManager.BrigadierInitializationExceptionCheck whether Brigadier can be used on the server instance- Throws:
BukkitCommandManager.BrigadierInitializationException- An exception is thrown if Brigadier isn't available. The exception will contain the reason for this.
-
registerBrigadier
Attempts to enable Brigadier command registration through Commodore.Callers should check for
CloudBukkitCapabilities.COMMODORE_BRIGADIERfirst to avoid exceptions.- Throws:
BukkitCommandManager.BrigadierInitializationException- when the prerequisite capabilities are not present or some other issue occurs during registration of Brigadier support- See Also:
-
hasBrigadierManager
- Specified by:
hasBrigadierManagerin interfaceBrigadierManagerHolder<C,Object> - Returns:
- Since:
- 2.0.0
-
brigadierManager
- Specified by:
brigadierManagerin interfaceBrigadierManagerHolder<C,Object> - Returns:
- Throws:
BrigadierManagerHolder.BrigadierManagerNotPresent- whenhasBrigadierManager()is false- Since:
- 1.2.0
-