Class RegionFlags

java.lang.Object
de.z0rdak.yawp.core.flag.RegionFlags
All Implemented Interfaces:
IFlagContainer

public class RegionFlags extends Object implements IFlagContainer
  • Field Details

    • CODEC

      public static com.mojang.serialization.Codec<RegionFlags> CODEC
  • Constructor Details

    • RegionFlags

      public RegionFlags()
    • RegionFlags

      public RegionFlags(Map<String,IFlag> flags)
  • Method Details

    • put

      public void put(IFlag flag)
      Specified by:
      put in interface IFlagContainer
    • get

      public IFlag get(String flagName)
      Description copied from interface: IFlagContainer
      Retrieves the flag associated with the given name.
      Specified by:
      get in interface IFlagContainer
      Parameters:
      flagName - the name of the flag
      Returns:
      the corresponding IFlag, or null if not found
    • remove

      public void remove(String flag)
      Specified by:
      remove in interface IFlagContainer
    • contains

      public boolean contains(String flag)
      Description copied from interface: IFlagContainer
      Checks if a flag with the given name exists in the container.
      Specified by:
      contains in interface IFlagContainer
      Parameters:
      flag - the name of the flag to check
      Returns:
      true if the flag exists, otherwise false
    • clear

      public void clear()
      Specified by:
      clear in interface IFlagContainer
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface IFlagContainer
    • size

      public int size()
      Specified by:
      size in interface IFlagContainer
    • flagEntries

      public Set<Map.Entry<String,IFlag>> flagEntries()
      Description copied from interface: IFlagContainer
      Retrieves a set of all flag entries in the container.
      Specified by:
      flagEntries in interface IFlagContainer
      Returns:
      a set of Map.Entry pairs, where the key is the flag name and the value is the corresponding IFlag
    • flags

      public List<IFlag> flags()
      Description copied from interface: IFlagContainer
      Retrieves all flags stored in the container.
      Specified by:
      flags in interface IFlagContainer
      Returns:
      a list of all IFlag objects in the container
    • flags

      public List<IFlag> flags(FlagState state)
      Description copied from interface: IFlagContainer
      Retrieves all flags that match the specified state.
      Specified by:
      flags in interface IFlagContainer
      Parameters:
      state - the FlagState to filter by
      Returns:
      a list of IFlag objects that have the specified state
    • flagState

      public FlagState flagState(String flagName)
      Retrieves the FlagState of a specified flag within this region.

      Since RegionFlags does not allow null values, a null flag is treated as FlagState.UNDEFINED. If the flag exists in the region, its state is returned. Otherwise, the method returns FlagState.UNDEFINED.

      Specified by:
      flagState in interface IFlagContainer
      Parameters:
      flagName - the name of the flag to check
      Returns:
      the FlagState of the specified flag, or FlagState.UNDEFINED if the flag is not present
    • isFlagDefined

      public boolean isFlagDefined(@NotNull @NotNull String flagName)
      Description copied from interface: IFlagContainer
      Checks whether the specified flag is defined (i.e., not UNDEFINED).
      Specified by:
      isFlagDefined in interface IFlagContainer
      Parameters:
      flagName - the flag to check, must not be null
      Returns:
      true if the flag is defined, otherwise false
    • isAllowedOrDenied

      public boolean isAllowedOrDenied(@NotNull @NotNull String flagName)
      Specified by:
      isAllowedOrDenied in interface IFlagContainer
    • getActiveFlags

      public Map<String,IFlag> getActiveFlags()
    • getFlagMap

      public Map<String,IFlag> getFlagMap()