Interface CommandManager

All Superinterfaces:
fr.maxlego08.menu.zcore.utils.storage.Savable

public interface CommandManager extends fr.maxlego08.menu.zcore.utils.storage.Savable
Manages the registration, loading, and execution of commands associated with inventories.
  • Method Details

    • registerCommand

      void registerCommand(Command command)
      Registers a new Command.
      Parameters:
      command - The new command to register.
    • getCommands

      Collection<Command> getCommands(org.bukkit.plugin.Plugin plugin)
      Returns the list of commands associated with a specific plugin.
      Parameters:
      plugin - The plugin for which to retrieve commands.
      Returns:
      A collection of commands associated with the plugin.
    • getCommands

      Collection<Command> getCommands()
      Returns all registered commands.
      Returns:
      A collection of all registered commands.
    • unregisterCommands

      void unregisterCommands(org.bukkit.plugin.Plugin plugin)
      Unregisters all commands associated with a specific plugin.
      Parameters:
      plugin - The plugin for which to unregister commands.
    • unregisterCommands

      void unregisterCommands(Command command)
      Unregisters a specific command.
      Parameters:
      command - The command to unregister.
    • loadCommands

      void loadCommands()
      Loads commands from the configuration files.
    • loadCommand

      void loadCommand(org.bukkit.plugin.Plugin plugin, File file)
      Loads a specific command from a plugin's configuration file.
      Parameters:
      plugin - The plugin to which the command belongs.
      file - The configuration file of the command.
    • getCommand

      Optional<Command> getCommand(Inventory inventory)
      Retrieves the command associated with a specific inventory.
      Parameters:
      inventory - The inventory for which to retrieve the command.
      Returns:
      An optional containing the associated command, or empty if not found.
    • setPlayerArgument

      void setPlayerArgument(org.bukkit.entity.Player player, String key, String value)
      Registers a key-value pair for the arguments of a command associated with a player.
      Parameters:
      player - The player for whom to register the arguments.
      key - The argument key.
      value - The argument value.
    • getPlayerArgument

      Optional<String> getPlayerArgument(UUID uuid, String key)
      Retrieves the value of an argument associated with a player and key.
      Parameters:
      uuid - The player uuid for whom to retrieve the argument.
      key - The argument key.
      Returns:
      An optional containing the argument value, or empty if not found.
    • getPlayerArgument

      Optional<String> getPlayerArgument(org.bukkit.entity.Player player, String key)
      Retrieves the value of an argument associated with a player and key.
      Parameters:
      player - The player for whom to retrieve the argument.
      key - The argument key.
      Returns:
      An optional containing the argument value, or empty if not found.
    • getCommand

      Optional<Command> getCommand(String commandName)
      Retrieves the command associated with a specific name.
      Parameters:
      commandName - The name of the command.
      Returns:
      An optional containing the associated command, or empty if not found.
    • reload

      boolean reload(Command command)
      Reloads a specific command.
      Parameters:
      command - The command to reload.
      Returns:
      true if the reload was successful, otherwise false.