Class FabricClientCommandManager<C>
- Type Parameters:
C
- the command sender type
- All Implemented Interfaces:
cloud.commandframework.brigadier.BrigadierManagerHolder<C>
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
-
Constructor Summary
ConstructorDescriptionFabricClientCommandManager
(@NonNull Function<@NonNull cloud.commandframework.CommandTree<@NonNull C>, @NonNull cloud.commandframework.execution.CommandExecutionCoordinator<@NonNull C>> commandExecutionCoordinator, @NonNull Function<@NonNull net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource, @NonNull C> commandSourceMapper, @NonNull Function<@NonNull C, @NonNull net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource> backwardsCommandSourceMapper) Create a new command manager instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic <C> @NonNull cloud.commandframework.permission.PredicatePermission<C>
Get a permission predicate which passes when cheats are enabled on the currently running integrated server.static <C> @NonNull cloud.commandframework.permission.PredicatePermission<C>
cheatsAllowed
(boolean allowOnMultiplayer) Get a permission predicate which passes when cheats are enabled on the currently running integrated server.static <C> @NonNull cloud.commandframework.permission.PredicatePermission<C>
Get a permission predicate which passes when cheats are disabled on the currently running integrated server.static <C> @NonNull cloud.commandframework.permission.PredicatePermission<C>
cheatsDisallowed
(boolean allowOnMultiplayer) Get a permission predicate which passes when cheats are disabled on the currently running integrated server.static @NonNull FabricClientCommandManager<@NonNull net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource>
createNative
(@NonNull Function<@NonNull cloud.commandframework.CommandTree<@NonNull net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource>, @NonNull cloud.commandframework.execution.CommandExecutionCoordinator<@NonNull net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource>> 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.static <C> @NonNull cloud.commandframework.permission.PredicatePermission<C>
Get a permission predicate which passes when the integrated server is not running.static <C> @NonNull cloud.commandframework.permission.PredicatePermission<C>
Get a permission predicate which passes when the integrated server is running.Methods inherited from class cloud.commandframework.fabric.FabricCommandManager
backwardsCommandSourceMapper, brigadierManager, commandSourceMapper, createDefaultCommandMeta, permissionLevel
Methods inherited from class cloud.commandframework.CommandManager
argumentBuilder, capabilities, captionRegistry, captionRegistry, captionVariableReplacementHandler, captionVariableReplacementHandler, command, command, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandBuilder, commandExecutionCoordinator, commandRegistrationHandler, commandRegistrationHandler, commands, commandSuggestionProcessor, commandSuggestionProcessor, commandSyntaxFormatter, commandSyntaxFormatter, commandTree, createCommandHelpHandler, createCommandHelpHandler, deleteRootCommand, executeCommand, flagBuilder, getCaptionRegistry, getCommandHelpHandler, getCommandHelpHandler, getCommandRegistrationHandler, getCommands, getCommandSuggestionProcessor, getCommandSyntaxFormatter, getCommandTree, getExceptionHandler, getParserRegistry, getRegistrationState, getSetting, handleException, hasCapability, hasPermission, isCommandRegistrationAllowed, lockRegistration, parameterInjectorRegistry, parserRegistry, postprocessContext, preprocessContext, registerCapability, registerCommandPostProcessor, registerCommandPreProcessor, registerDefaultCaptions, registerExceptionHandler, registrationState, requireState, rootCommands, setCaptionRegistry, setCommandRegistrationHandler, setCommandSuggestionProcessor, setCommandSyntaxFormatter, setSetting, suggest, transitionIfPossible, transitionOrThrow
-
Constructor Details
-
FabricClientCommandManager
public FabricClientCommandManager(@NonNull Function<@NonNull cloud.commandframework.CommandTree<@NonNull C>, @NonNull cloud.commandframework.execution.CommandExecutionCoordinator<@NonNull C>> commandExecutionCoordinator, @NonNull Function<@NonNull net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource, @NonNull C> commandSourceMapper, @NonNull Function<@NonNull C, @NonNull net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource> 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 mapsFabricClientCommandSource
to the command sender typebackwardsCommandSourceMapper
- Function that maps the command sender type toFabricClientCommandSource
- Since:
- 1.5.0
-
-
Method Details
-
createNative
public static @NonNull FabricClientCommandManager<@NonNull net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource> createNative(@NonNull Function<@NonNull cloud.commandframework.CommandTree<@NonNull net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource>, @NonNull cloud.commandframework.execution.CommandExecutionCoordinator<@NonNull net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource>> 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 implementation for client commands always returns true.
- 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
-
integratedServerRunning
public static <C> @NonNull cloud.commandframework.permission.PredicatePermission<C> integratedServerRunning()Get a permission predicate which passes when the integrated server is running.- Type Parameters:
C
- sender type- Returns:
- a predicate permission
- Since:
- 1.5.0
-
integratedServerNotRunning
public static <C> @NonNull cloud.commandframework.permission.PredicatePermission<C> integratedServerNotRunning()Get a permission predicate which passes when the integrated server is not running.- Type Parameters:
C
- sender type- Returns:
- a predicate permission
- Since:
- 1.5.0
-
cheatsAllowed
public static <C> @NonNull cloud.commandframework.permission.PredicatePermission<C> cheatsAllowed()Get a permission predicate which passes when cheats are enabled on the currently running integrated server.This predicate will always pass if there is no integrated server running, i.e. when connected to a multiplayer server.
- Type Parameters:
C
- sender type- Returns:
- a predicate permission
- Since:
- 1.5.0
-
cheatsAllowed
public static <C> @NonNull cloud.commandframework.permission.PredicatePermission<C> cheatsAllowed(boolean allowOnMultiplayer) Get a permission predicate which passes when cheats are enabled on the currently running integrated server.When there is no integrated server running, i.e. when connected to a multiplayer server, the predicate will fall back to the provided boolean argument.
- Type Parameters:
C
- sender type- Parameters:
allowOnMultiplayer
- whether the predicate should pass on multiplayer servers- Returns:
- a predicate permission
- Since:
- 1.5.0
-
cheatsDisallowed
public static <C> @NonNull cloud.commandframework.permission.PredicatePermission<C> cheatsDisallowed()Get a permission predicate which passes when cheats are disabled on the currently running integrated server.This predicate will always pass if there is no integrated server running, i.e. when connected to a multiplayer server.
- Type Parameters:
C
- sender type- Returns:
- a predicate permission
- Since:
- 1.5.0
-
cheatsDisallowed
public static <C> @NonNull cloud.commandframework.permission.PredicatePermission<C> cheatsDisallowed(boolean allowOnMultiplayer) Get a permission predicate which passes when cheats are disabled on the currently running integrated server.When there is no integrated server running, i.e. when connected to a multiplayer server, the predicate will fall back to the provided boolean argument.
- Type Parameters:
C
- sender type- Parameters:
allowOnMultiplayer
- whether the predicate should pass on multiplayer servers- Returns:
- a predicate permission
- Since:
- 1.5.0
-