Class BattleClauseRegistry

java.lang.Object
com.pixelmonmod.pixelmon.battles.api.rules.clauses.BattleClauseRegistry

public final class BattleClauseRegistry extends Object
Keeps track of all clauses that are registered in the game.
  • Field Details

  • Constructor Details

    • BattleClauseRegistry

      public BattleClauseRegistry()
  • Method Details

    • getClause

      public static BattleClause getClause(String id)
      Gets a registered clause by its ID.
      Parameters:
      id - The ID of the clause.
      Returns:
      The clause with the given ID, or an no-op clause if there is no clause with the given ID.
    • hasClause

      public static boolean hasClause(String id)
      Checks if a clause is registered.
      Parameters:
      id - The ID of the clause.
      Returns:
      Whether a clause with the given ID is registered.
    • register

      public static <T extends BattleClause> T register(T newClause)
      Registers a new clause in the registry. Returns self to allow for easy caching
      Parameters:
      newClause - The new clause to register.
      Returns:
      The parameter given - unmodified
      Throws:
      IllegalArgumentException - If the clause has no key or a key conflicting with another clause.
    • getClauseList

      public static List<BattleClause> getClauseList()
      Returns a sorted list of all registered clauses.
      Returns:
      A sorted list of all registered clauses.