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

    Fields
    Modifier and Type
    Field
    Description
    static 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

    Constructors
    Constructor
    Description
    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.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    boolean
    hasPermission(@NonNull C sender, @NonNull String permission)
    Check if a sender has a certain permission.

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • META_REGISTRATION_ENVIRONMENT

      public static final cloud.commandframework.meta.CommandMeta.Key<net.minecraft.commands.Commands.CommandSelection> META_REGISTRATION_ENVIRONMENT
      A 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 between CommandExecutionCoordinator.simpleCoordinator() and AsynchronousCommandExecutionCoordinator
      commandSourceMapper - Function that maps CommandSourceStack to the command sender type
      backwardsCommandSourceMapper - Function that maps the command sender type to CommandSourceStack
      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

      public boolean hasPermission(@NonNull C sender, @NonNull String permission)
      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 class cloud.commandframework.CommandManager<C>
      Parameters:
      sender - Command sender
      permission - Permission node
      Returns:
      whether the sender has the specified permission
      Since:
      1.5.0