Class ActionLoader

java.lang.Object
io.github.lucfr1746.llibrary.action.ActionLoader

public class ActionLoader extends Object
Loads and manages different types of actions in the plugin. Provides a way to register, retrieve, and process actions based on string inputs.
  • Constructor Details

    • ActionLoader

      public ActionLoader()
      Initializes the ActionLoader and registers all available actions.
  • Method Details

    • registerAction

      public void registerAction(String identifier, Function<String,Action> factory)
      Registers an action with a specific identifier.
      Parameters:
      identifier - The string identifier for the action.
      factory - The function that creates the action instance.
    • getAction

      public Action getAction(String input)
      Retrieves an Action instance based on an input string.
      Parameters:
      input - The input string defining the action.
      Returns:
      The corresponding Action instance or null if not found.
    • getActions

      public List<Action> getActions(List<String> inputs)
      Retrieves a list of Action instances based on a list of input strings.
      Parameters:
      inputs - A list of action input strings.
      Returns:
      A list of corresponding Action instances.