Class GeyserCommand

java.lang.Object
org.geysermc.geyser.command.GeyserCommand
All Implemented Interfaces:
org.geysermc.geyser.api.command.Command
Direct Known Subclasses:
AdvancedTooltipsCommand, AdvancementsCommand, ConnectionTestCommand, CustomOptionsCommand, DumpCommand, ExtensionsCommand, GeyserExtensionCommand, HelpCommand, ListCommand, OffhandCommand, PingCommand, QuickActionsCommand, ReloadCommand, SettingsCommand, StatisticsCommand, StopCommand, VersionCommand

public abstract class GeyserCommand extends Object implements org.geysermc.geyser.api.command.Command
  • Field Details

    • DEFAULT_ROOT_COMMAND

      public static final String DEFAULT_ROOT_COMMAND
      See Also:
    • aliases

      protected List<String> aliases
      The aliases of the command name. This should not be modified after construction.
  • Constructor Details

    • GeyserCommand

      public GeyserCommand(@NonNull String name, @NonNull String description, @NonNull String permission, @Nullable org.geysermc.geyser.api.util.TriState permissionDefault, boolean playerOnly, boolean bedrockOnly)
    • GeyserCommand

      public GeyserCommand(@NonNull String name, @NonNull String description, @NonNull String permission, @Nullable org.geysermc.geyser.api.util.TriState permissionDefault)
  • Method Details

    • name

      public final @NonNull String name()
      Specified by:
      name in interface org.geysermc.geyser.api.command.Command
    • description

      public final @NonNull String description()
      Specified by:
      description in interface org.geysermc.geyser.api.command.Command
    • permission

      public final @NonNull String permission()
      Specified by:
      permission in interface org.geysermc.geyser.api.command.Command
    • permissionDefault

      public final @Nullable org.geysermc.geyser.api.util.TriState permissionDefault()
    • isPlayerOnly

      public final boolean isPlayerOnly()
      Specified by:
      isPlayerOnly in interface org.geysermc.geyser.api.command.Command
    • isBedrockOnly

      public final boolean isBedrockOnly()
      Specified by:
      isBedrockOnly in interface org.geysermc.geyser.api.command.Command
    • aliases

      public final @NonNull List<String> aliases()
      Specified by:
      aliases in interface org.geysermc.geyser.api.command.Command
    • rootCommand

      public String rootCommand()
      Returns:
      the first (literal) argument of this command, which comes before name().
    • commandPermission

      public final GeyserPermission commandPermission(org.incendo.cloud.CommandManager<GeyserCommandSource> manager)
      Returns a Permission that handles isBedrockOnly(), isPlayerOnly(), and permission().
      Parameters:
      manager - the manager to be used for permission node checking
      Returns:
      a permission that will properly restrict usage of this command
    • baseBuilder

      @Contract(value="_ -> new", pure=true) public final org.incendo.cloud.Command.Builder<GeyserCommandSource> baseBuilder(org.incendo.cloud.CommandManager<GeyserCommandSource> manager)
      Creates a new command builder with rootCommand(), name(), and aliases() built on it. A permission predicate that takes into account permission(), isBedrockOnly(), and isPlayerOnly() is applied. The Applicable from meta() is also applied to the builder.
    • meta

      protected org.incendo.cloud.Command.Builder.Applicable<GeyserCommandSource> meta()
      Returns:
      an Applicable that applies this command's description
    • register

      public void register(org.incendo.cloud.CommandManager<GeyserCommandSource> manager)
      Registers this command to the given command manager. This method may be overridden to register more than one command.

      The default implementation is that baseBuilder(CommandManager) with execute(CommandContext) applied as the handler is registered to the manager.

    • execute

      public abstract void execute(org.incendo.cloud.context.CommandContext<GeyserCommandSource> context)
      Executes this command
      Parameters:
      context - the context with which this command should be executed