Class BukkitHandler

java.lang.Object
revxrsal.commands.core.BaseCommandHandler
revxrsal.commands.bukkit.core.BukkitHandler
All Implemented Interfaces:
BukkitCommandHandler, CommandHandler

public final class BukkitHandler extends BaseCommandHandler implements BukkitCommandHandler
  • Field Details

    • playerSuggestionProvider

      public static final SuggestionProvider playerSuggestionProvider
  • Constructor Details

    • BukkitHandler

      public BukkitHandler(@NotNull @NotNull org.bukkit.plugin.Plugin plugin)
  • Method Details

    • register

      @NotNull public @NotNull CommandHandler register(@NotNull @NotNull Object... commands)
      Description copied from interface: CommandHandler
      Registers the specified command from an instance. This will automatically set all Dependency-annotated fields with their values.
      Specified by:
      register in interface CommandHandler
      Overrides:
      register in class BaseCommandHandler
      Parameters:
      commands - The commands object instances. Can be a class if methods are static.
      Returns:
      This command handler
    • getBrigadier

      @NotNull public @NotNull Optional<BukkitBrigadier> getBrigadier()
      Description copied from interface: BukkitCommandHandler
      Returns an optional BukkitBrigadier of this command handler.

      On versions that do not support Brigadier (i.e. 1.12.2 or earlier), this optional will be empty.

      Specified by:
      getBrigadier in interface BukkitCommandHandler
      Returns:
      The Brigadier accessor
    • isBrigadierSupported

      public boolean isBrigadierSupported()
      Description copied from interface: BukkitCommandHandler
      Checks to see if the Brigadier command system is supported by the server.
      Specified by:
      isBrigadierSupported in interface BukkitCommandHandler
      Returns:
      true if Brigadier is supported.
    • registerBrigadier

      public BukkitCommandHandler registerBrigadier()
      Description copied from interface: BukkitCommandHandler
      Registers commands automatically on Minecraft's 1.13+ command system (so that you would get the colorful command completions!)

      Note that you should call this method after you've registered all your commands.

      This is effectively the same as getBrigadier().register(), and will have no effect when invoked on older versions.

      Specified by:
      registerBrigadier in interface BukkitCommandHandler
      Returns:
      This command handler
    • enableAdventure

      public void enableAdventure()
      Description copied from interface: BukkitCommandHandler
      Instantiates a BukkitAudiences internally and allows accessing APIs such as BukkitCommandActor.audience()
      Specified by:
      enableAdventure in interface BukkitCommandHandler
    • enableAdventure

      public void enableAdventure(@NotNull @NotNull net.kyori.adventure.platform.bukkit.BukkitAudiences audiences)
      Description copied from interface: BukkitCommandHandler
      Uses the given BukkitAudiences for creating audiences for BukkitCommandActors. This allows accessing APIs such as BukkitCommandActor.audience(),
      Specified by:
      enableAdventure in interface BukkitCommandHandler
      Parameters:
      audiences - Audiences to use for command actors
    • getPlugin

      @NotNull public @NotNull org.bukkit.plugin.Plugin getPlugin()
      Description copied from interface: BukkitCommandHandler
      Returns the plugin this command handler was registered for.
      Specified by:
      getPlugin in interface BukkitCommandHandler
      Returns:
      The owning plugin
    • unregister

      public boolean unregister(@NotNull @NotNull CommandPath path)
      Description copied from interface: CommandHandler
      Unregisters the given path and all the sub-paths that belong to it
      Specified by:
      unregister in interface CommandHandler
      Overrides:
      unregister in class BaseCommandHandler
      Parameters:
      path - Path to unregister
      Returns:
      True if one or more elements were removed by this call.
    • getSelectedEntity

      public static Class<? extends org.bukkit.entity.Entity> getSelectedEntity(@NotNull @NotNull Type selectorType)