Interface IFlagContainer

All Known Implementing Classes:
RegionFlags

public interface IFlagContainer
Represents a container holding flag values mapped to their corresponding flag names for a region. Provides methods for adding, retrieving, updating, and removing flags, as well as handling their states.

Flags are stored as key-value pairs:
  • Key: Flag name as a String
  • Value: Corresponding IFlag instance
Example:
 "break_blocks" -> BooleanFlag {"state": "Denied", ...}
 
This interface allows for checking flag existence, retrieving active flags, and filtering by FlagState.
  • Method Details

    • put

      void put(IFlag flag)
    • get

      IFlag get(String flag)
      Retrieves the flag associated with the given name.
      Parameters:
      flag - the name of the flag
      Returns:
      the corresponding IFlag, or null if not found
    • remove

      void remove(String flag)
    • contains

      boolean contains(String flag)
      Checks if a flag with the given name exists in the container.
      Parameters:
      flag - the name of the flag to check
      Returns:
      true if the flag exists, otherwise false
    • clear

      void clear()
    • isEmpty

      boolean isEmpty()
    • size

      int size()
    • flagState

      FlagState flagState(String flag)
      Retrieves the state of the specified flag.
      Parameters:
      flag - the name of the flag to check
      Returns:
      the FlagState of the flag if it exists; otherwise, returns FlagState.UNDEFINED.
    • isAllowedOrDenied

      boolean isAllowedOrDenied(@NotNull @NotNull String flagName)
    • isFlagDefined

      boolean isFlagDefined(String flag)
      Checks whether the specified flag is defined (i.e., not UNDEFINED).
      Parameters:
      flag - the flag to check, must not be null
      Returns:
      true if the flag is defined, otherwise false
    • flags

      List<IFlag> flags()
      Retrieves all flags stored in the container.
      Returns:
      a list of all IFlag objects in the container
    • flags

      List<IFlag> flags(FlagState state)
      Retrieves all flags that match the specified state.
      Parameters:
      state - the FlagState to filter by
      Returns:
      a list of IFlag objects that have the specified state
    • flagEntries

      Set<Map.Entry<String,IFlag>> flagEntries()
      Retrieves a set of all flag entries in the container.
      Returns:
      a set of Map.Entry pairs, where the key is the flag name and the value is the corresponding IFlag