Interface CommandMapModifier


public interface CommandMapModifier
NMS abstraction interface for modifying Bukkit's internal command map.

This interface provides version-specific implementations for registering and unregistering commands directly with Bukkit's command system, bypassing the standard plugin.yml registration process.

This is particularly useful for dynamic command registration at runtime or for plugins that need fine-grained control over command management.

  • Method Details

    • unregisterCommand

      void unregisterCommand(@NotNull @NotNull Command command)
      Unregisters a Bukkit Command from the internal command map.

      This removes the command from the server's command registry, making it no longer available for execution by players or console. The command will be completely removed from the known commands map.

      Parameters:
      command - the Command to unregister from the command map
    • registerCommand

      void registerCommand(@NotNull @NotNull Command command, @NotNull @NotNull Plugin plugin)
      Registers a Bukkit Command to the internal command map.

      This adds the command to the server's command registry, making it available for execution. The command will be associated with the specified plugin for ownership tracking.

      Parameters:
      command - the Command to register to the command map
      plugin - the Plugin that owns this command
    • getKnownCommands

      @NotNull @NotNull Map<String,Command> getKnownCommands()
      Retrieves the internal command map containing all known commands.

      This provides direct access to Bukkit's internal command registry, allowing inspection of all registered commands. The returned map maps command names to their corresponding Command instances.

      Returns:
      a Map of command names to Command instances representing all known commands in the server