Package de.z0rdak.yawp.core.flag
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:
Flags are stored as key-value pairs:
- Key: Flag name as a
String - Value: Corresponding
IFlaginstance
"break_blocks" -> BooleanFlag {"state": "Denied", ...}
This interface allows for checking flag existence, retrieving active flags, and filtering by FlagState.-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleanChecks if a flag with the given name exists in the container.Retrieves a set of all flag entries in the container.flags()Retrieves all flags stored in the container.Retrieves all flags that match the specified state.Retrieves the state of the specified flag.Retrieves the flag associated with the given name.booleanisAllowedOrDenied(@NotNull String flagName) booleanisEmpty()booleanisFlagDefined(String flag) Checks whether the specified flag is defined (i.e., notUNDEFINED).voidvoidintsize()
-
Method Details
-
put
-
get
Retrieves the flag associated with the given name.- Parameters:
flag- the name of the flag- Returns:
- the corresponding
IFlag, ornullif not found
-
remove
-
contains
Checks if a flag with the given name exists in the container.- Parameters:
flag- the name of the flag to check- Returns:
trueif the flag exists, otherwisefalse
-
clear
void clear() -
isEmpty
boolean isEmpty() -
size
int size() -
flagState
Retrieves the state of the specified flag.- Parameters:
flag- the name of the flag to check- Returns:
- the
FlagStateof the flag if it exists; otherwise, returnsFlagState.UNDEFINED.
-
isAllowedOrDenied
-
isFlagDefined
Checks whether the specified flag is defined (i.e., notUNDEFINED).- Parameters:
flag- the flag to check, must not benull- Returns:
trueif the flag is defined, otherwisefalse
-
flags
Retrieves all flags stored in the container.- Returns:
- a list of all
IFlagobjects in the container
-
flags
Retrieves all flags that match the specified state. -
flagEntries
Retrieves a set of all flag entries in the container.
-