Package org.incendo.cloud.fabric
Class FabricServerCommandManager<C>
java.lang.Object
org.incendo.cloud.CommandManager<C>
org.incendo.cloud.fabric.FabricCommandManager<C,net.minecraft.commands.CommandSourceStack>
org.incendo.cloud.fabric.FabricServerCommandManager<C>
- Type Parameters:
C- the command sender type
- All Implemented Interfaces:
org.incendo.cloud.brigadier.BrigadierManagerHolder<C,,net.minecraft.commands.CommandSourceStack> org.incendo.cloud.CommandBuilderSource<C>,org.incendo.cloud.SenderMapperHolder<net.minecraft.commands.CommandSourceStack,,C> org.incendo.cloud.state.Stateful<org.incendo.cloud.state.RegistrationState>
public final class FabricServerCommandManager<C>
extends FabricCommandManager<C,net.minecraft.commands.CommandSourceStack>
A command manager for registering server-side commands.
All commands should be registered within mod initializers. Any registrations occurring after the first call to
CommandRegistrationCallback will be considered unsafe, and will only be permitted when the unsafe
registration manager option is enabled.
- Since:
- 1.5.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.incendo.cloud.brigadier.BrigadierManagerHolder
org.incendo.cloud.brigadier.BrigadierManagerHolder.BrigadierManagerNotPresent -
Constructor Summary
ConstructorsConstructorDescriptionFabricServerCommandManager(@NonNull org.incendo.cloud.execution.ExecutionCoordinator<C> commandExecutionCoordinator, @NonNull org.incendo.cloud.SenderMapper<net.minecraft.commands.CommandSourceStack, C> senderMapper) Create a new command manager instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull FabricServerCommandManager<@NonNull net.minecraft.commands.CommandSourceStack>createNative(@NonNull org.incendo.cloud.execution.ExecutionCoordinator<net.minecraft.commands.CommandSourceStack> execCoordinator) Create a command manager using native source types.booleanhasPermission(@NonNull C sender, @NonNull String permission) Check if a sender has a certain permission.Methods inherited from class org.incendo.cloud.fabric.FabricCommandManager
brigadierManager, hasBrigadierManager, senderMapper, suggestionFactoryMethods inherited from class org.incendo.cloud.CommandManager
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, rootCommands, settings, state, 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
-
FabricServerCommandManager
@API(status=STABLE, since="2.0.0") public FabricServerCommandManager(@NonNull org.incendo.cloud.execution.ExecutionCoordinator<C> commandExecutionCoordinator, @NonNull org.incendo.cloud.SenderMapper<net.minecraft.commands.CommandSourceStack, C> senderMapper) Create a new command manager instance.- Parameters:
commandExecutionCoordinator- Execution coordinator instance. The coordinator is in charge of executing incoming commands. Some considerations must be made when picking a suitable execution coordinator for your platform. For example, an entirely asynchronous coordinator is not suitable when the parsers used in that particular platform are not thread safe. If you have commands that perform blocking operations, however, it might not be a good idea to use a synchronous execution coordinator. In most cases you will want to pick betweenExecutionCoordinator.simpleCoordinator()andExecutionCoordinator.asyncCoordinator()senderMapper- Function that mapsCommandSourceStackto the command sender type- Since:
- 1.5.0
-
-
Method Details
-
createNative
@API(status=STABLE, since="2.0.0") public static @NonNull FabricServerCommandManager<@NonNull net.minecraft.commands.CommandSourceStack> createNative(@NonNull org.incendo.cloud.execution.ExecutionCoordinator<net.minecraft.commands.CommandSourceStack> execCoordinator) Create a command manager using native source types.- Parameters:
execCoordinator- Execution coordinator instance.- Returns:
- a new command manager
- Since:
- 1.5.0
- See Also:
-
hasPermission
Check if a sender has a certain permission.The current implementation checks permissions using
fabric-permissions-api-v0, falling back to op level checks.- Specified by:
hasPermissionin classorg.incendo.cloud.CommandManager<C>- Parameters:
sender- Command senderpermission- Permission node- Returns:
- whether the sender has the specified permission
- Since:
- 1.5.0
-