Interface FlagContainer

    • Method Detail

      • getParentContainer

        @Nullable
        @Nullable FlagContainer getParentContainer()
        Return the parent container (if the container has a parent)
        Returns:
        Parent container, if it exists
      • setParentContainer

        void setParentContainer​(FlagContainer parentContainer)
      • getInternalPlotFlagMap

        Map<Class<?>,​WorldFlag<?,​?>> getInternalPlotFlagMap()
      • getFlagMap

        Map<Class<?>,​WorldFlag<?,​?>> getFlagMap()
        Get an immutable view of the underlying flag map
        Returns:
        Immutable flag map
      • addFlag

        <V,​T extends WorldFlag<V,​?>> void addFlag​(T flag)
        Add a flag to the container
        Parameters:
        flag - Flag to add
        See Also:
        to add multiple flags
      • removeFlag

        <V,​T extends WorldFlag<V,​?>> V removeFlag​(T flag)
        Remove a flag from the container
        Parameters:
        flag - Flag to remove
      • clearLocal

        void clearLocal()
        Clears the local flag map
      • getRecognizedPlotFlags

        Collection<WorldFlag<?,​?>> getRecognizedPlotFlags()
        Get a collection of all recognized world flags. Will by default use the values contained in GlobalWorldFlagContainer.
        Returns:
        All recognized flag types
      • getHighestClassContainer

        FlagContainer getHighestClassContainer()
        Recursively seek for the highest order flag container. This will by default return GlobalWorldFlagContainer.
        Returns:
        Highest order class container.
      • getFlagErased

        WorldFlag<?,​?> getFlagErased​(Class<?> flagClass)
        Has the same functionality as getFlag(Class), but with wildcard generic types.
        Parameters:
        flagClass - The WorldFlag class.
      • getFlag

        <V,​T extends WorldFlag<V,​?>> T getFlag​(Class<? extends T> flagClass)
        Query all levels of flag containers for a flag. This guarantees that a flag instance is returned, as long as it is registered in the global flag container.
        Type Parameters:
        V - Flag value type
        T - Flag type
        Parameters:
        flagClass - Flag class to query for
        Returns:
        Flag instance
      • queryLocal

        @Nullable
        <V,​T extends WorldFlag<V,​?>> T queryLocal​(Class<?> flagClass)
        Check for flag existence in this flag container instance.
        Type Parameters:
        V - Flag value type
        T - Flag type
        Parameters:
        flagClass - Flag class to query for
        Returns:
        The flag instance, if it exists in this container, else null.
      • subscribe

        void subscribe​(@NotNull
                       FlagContainer.WorldFlagUpdateHandler worldFlagUpdateHandler)
        Subscribe to flag updates in this particular flag container instance. Updates are: a flag being removed, a flag being added or a flag being updated.
        Parameters:
        worldFlagUpdateHandler - The update handler which will react to changes.
        See Also:
        World flag update types
      • addUnknownFlag

        void addUnknownFlag​(String flagName,
                            String value)
        Register a flag key-value pair which cannot yet be associated with an existing flag instance (such as when third party flag values are loaded before the flag type has been registered).

        These values will be registered in the flag container if the associated flag type is registered in the top level flag container.

        Parameters:
        flagName - Flag name
        value - Flag value