Class SimpleFlagRegistry

java.lang.Object
com.sk89q.worldguard.protection.flags.registry.SimpleFlagRegistry
All Implemented Interfaces:
FlagRegistry, Iterable<Flag<?>>

public class SimpleFlagRegistry extends Object implements FlagRegistry
  • Constructor Details

    • SimpleFlagRegistry

      public SimpleFlagRegistry()
  • Method Details

    • isInitialized

      public boolean isInitialized()
    • setInitialized

      public void setInitialized(boolean initialized)
    • register

      public void register(Flag<?> flag) throws FlagConflictException
      Description copied from interface: FlagRegistry
      Register a new flag.

      There may be an appropriate time to register flags. If flags are registered outside this time, then an exception may be thrown.

      Specified by:
      register in interface FlagRegistry
      Parameters:
      flag - The flag
      Throws:
      FlagConflictException - Thrown when an existing flag exists with the same name
    • registerAll

      public void registerAll(Collection<Flag<?>> flags)
      Description copied from interface: FlagRegistry
      Register a collection of flags.

      There may be an appropriate time to register flags. If flags are registered outside this time, then an exception may be thrown.

      If there is a flag conflict, then an error will be logged but no exception will be thrown.

      Specified by:
      registerAll in interface FlagRegistry
      Parameters:
      flags - a collection of flags
    • get

      @Nullable public Flag<?> get(String name)
      Description copied from interface: FlagRegistry
      Get af flag by its name.
      Specified by:
      get in interface FlagRegistry
      Parameters:
      name - The name
      Returns:
      The flag, if it has been registered
    • getAll

      public List<Flag<?>> getAll()
      Description copied from interface: FlagRegistry
      Get all flags
      Specified by:
      getAll in interface FlagRegistry
      Returns:
      All flags
    • unmarshal

      public Map<Flag<?>,Object> unmarshal(Map<String,Object> rawValues, boolean createUnknown)
      Description copied from interface: FlagRegistry
      Unmarshal a raw map of values into a map of flags with their unmarshalled values.
      Specified by:
      unmarshal in interface FlagRegistry
      Parameters:
      rawValues - The raw values map
      createUnknown - Whether "just in time" flags should be created for unknown flags
      Returns:
      The unmarshalled flag values map
    • size

      public int size()
      Description copied from interface: FlagRegistry
      Get the number of registered flags.
      Specified by:
      size in interface FlagRegistry
      Returns:
      The number of registered flags
    • iterator

      public Iterator<Flag<?>> iterator()
      Specified by:
      iterator in interface Iterable<Flag<?>>