Class FabricClientCommandManager<C>

java.lang.Object
org.incendo.cloud.CommandManager<C>
org.incendo.cloud.fabric.FabricCommandManager<C,net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource>
org.incendo.cloud.fabric.FabricClientCommandManager<C>
Type Parameters:
C - the command sender type
All Implemented Interfaces:
BrigadierManagerHolder<C,net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource>, CommandBuilderSource<C>, SenderMapperHolder<net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource,C>, Stateful<RegistrationState>

public final class FabricClientCommandManager<C> extends FabricCommandManager<C,net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource>
A command manager for registering client-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
  • Constructor Details

    • FabricClientCommandManager

      @API(status=STABLE, since="2.0.0") public FabricClientCommandManager(@NonNull ExecutionCoordinator<C> commandExecutionCoordinator, @NonNull SenderMapper<net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource,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 between ExecutionCoordinator.simpleCoordinator() and ExecutionCoordinator.asyncCoordinator()
      senderMapper - Function that maps FabricClientCommandSource to the command sender type
      Since:
      1.5.0
  • Method Details

    • createNative

      @API(status=STABLE, since="2.0.0") public static @NonNull FabricClientCommandManager<@NonNull net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource> createNative(@NonNull ExecutionCoordinator<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

      public boolean hasPermission(@NonNull C sender, @NonNull String permission)
      Check if a sender has a certain permission.

      The implementation for client commands always returns true.

      Specified by:
      hasPermission in class CommandManager<C>
      Parameters:
      sender - Command sender
      permission - Permission node
      Returns:
      whether the sender has the specified permission
      Since:
      1.5.0