Package cloud.commandframework.fabric
Class FabricServerCommandManager<C>
java.lang.Object
cloud.commandframework.CommandManager<C>
cloud.commandframework.fabric.FabricCommandManager<C,net.minecraft.commands.CommandSourceStack>
cloud.commandframework.fabric.FabricServerCommandManager<C>
- Type Parameters:
C
- the command sender type
- All Implemented Interfaces:
cloud.commandframework.brigadier.BrigadierManagerHolder<C>
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 class cloud.commandframework.CommandManager
cloud.commandframework.CommandManager.ManagerSettings, cloud.commandframework.CommandManager.RegistrationState
-
Field Summary
Modifier and TypeFieldDescriptionstatic final cloud.commandframework.meta.CommandMeta.Key<net.minecraft.commands.Commands.CommandSelection>
A meta attribute specifying which environments a command should be registered in. -
Constructor Summary
ConstructorDescriptionFabricServerCommandManager
(@NonNull Function<@NonNull cloud.commandframework.CommandTree<@NonNull C>, @NonNull cloud.commandframework.execution.CommandExecutionCoordinator<@NonNull C>> commandExecutionCoordinator, @NonNull Function<@NonNull net.minecraft.commands.CommandSourceStack, @NonNull C> commandSourceMapper, @NonNull Function<@NonNull C, @NonNull net.minecraft.commands.CommandSourceStack> backwardsCommandSourceMapper) Create a new command manager instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull FabricServerCommandManager<@NonNull net.minecraft.commands.CommandSourceStack>
createNative
(@NonNull Function<@NonNull cloud.commandframework.CommandTree<@NonNull net.minecraft.commands.CommandSourceStack>, @NonNull cloud.commandframework.execution.CommandExecutionCoordinator<@NonNull net.minecraft.commands.CommandSourceStack>> execCoordinator) Create a command manager using native source types.boolean
hasPermission
(@NonNull C sender, @NonNull String permission) Check if a sender has a certain permission.Methods inherited from class cloud.commandframework.fabric.FabricCommandManager
backwardsCommandSourceMapper, brigadierManager, commandSourceMapper, createDefaultCommandMeta, permissionLevel
Methods inherited from class cloud.commandframework.CommandManager
argumentBuilder, command, command, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandExecutionCoordinator, executeCommand, flagBuilder, getCaptionRegistry, getCommandHelpHandler, getCommandHelpHandler, getCommandRegistrationHandler, getCommands, getCommandSuggestionProcessor, getCommandSyntaxFormatter, getCommandTree, getExceptionHandler, getParserRegistry, getRegistrationState, getSetting, handleException, hasPermission, isCommandRegistrationAllowed, lockRegistration, parameterInjectorRegistry, postprocessContext, preprocessContext, registerCommandPostProcessor, registerCommandPreProcessor, registerDefaultCaptions, registerExceptionHandler, requireState, setCaptionRegistry, setCommandRegistrationHandler, setCommandSuggestionProcessor, setCommandSyntaxFormatter, setSetting, suggest, transitionIfPossible, transitionOrThrow
-
Field Details
-
META_REGISTRATION_ENVIRONMENT
public static final cloud.commandframework.meta.CommandMeta.Key<net.minecraft.commands.Commands.CommandSelection> META_REGISTRATION_ENVIRONMENTA meta attribute specifying which environments a command should be registered in.The default value is
Commands.CommandSelection.ALL
.- Since:
- 1.5.0
-
-
Constructor Details
-
FabricServerCommandManager
public FabricServerCommandManager(@NonNull Function<@NonNull cloud.commandframework.CommandTree<@NonNull C>, @NonNull cloud.commandframework.execution.CommandExecutionCoordinator<@NonNull C>> commandExecutionCoordinator, @NonNull Function<@NonNull net.minecraft.commands.CommandSourceStack, @NonNull C> commandSourceMapper, @NonNull Function<@NonNull C, @NonNull net.minecraft.commands.CommandSourceStack> backwardsCommandSourceMapper) 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 betweenCommandExecutionCoordinator.simpleCoordinator()
andAsynchronousCommandExecutionCoordinator
commandSourceMapper
- Function that mapsCommandSourceStack
to the command sender typebackwardsCommandSourceMapper
- Function that maps the command sender type toCommandSourceStack
- Since:
- 1.5.0
-
-
Method Details
-
createNative
public static @NonNull FabricServerCommandManager<@NonNull net.minecraft.commands.CommandSourceStack> createNative(@NonNull Function<@NonNull cloud.commandframework.CommandTree<@NonNull net.minecraft.commands.CommandSourceStack>, @NonNull cloud.commandframework.execution.CommandExecutionCoordinator<@NonNull 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:
hasPermission
in classcloud.commandframework.CommandManager<C>
- Parameters:
sender
- Command senderpermission
- Permission node- Returns:
- whether the sender has the specified permission
- Since:
- 1.5.0
-