Class FlagManager
java.lang.Object
studio.magemonkey.fabled.api.util.FlagManager
The manager for temporary entity flag data
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Adds a flag to an entitystatic void
clearFlags
(org.bukkit.entity.LivingEntity entity) Clears the flags for an entitystatic FlagData
getFlagData
(org.bukkit.entity.LivingEntity entity) Retrieves the flag data for an entity.static FlagData
getFlagData
(org.bukkit.entity.LivingEntity entity, boolean create) Retrieves the flag data for an entity, optionally creating new data if none currently exists.static int
getTimeLeft
(org.bukkit.entity.LivingEntity entity, String flag) Retrieves the time left on a flag for an entitystatic boolean
Checks whether the entity has the given flagstatic void
removeFlag
(org.bukkit.entity.LivingEntity entity, String flag) Removes the flag from an entity
-
Constructor Details
-
FlagManager
public FlagManager()
-
-
Method Details
-
getFlagData
Retrieves the flag data for an entity. This creates new data if no existing data is found.- Parameters:
entity
- entity to retrieve the data for- Returns:
- the flag data for the entity
-
getFlagData
Retrieves the flag data for an entity, optionally creating new data if none currently exists. If set to false, this will return null if no data currently exists.- Parameters:
entity
- entity to get the flag data forcreate
- whether to create new data if it doesn't exist- Returns:
- the flag data for an enemy
-
addFlag
Adds a flag to an entity- Parameters:
entity
- entity to add the flag toflag
- the flag to addticks
- the duration to add the flag for
-
removeFlag
Removes the flag from an entity- Parameters:
entity
- entity to remove the flag fromflag
- flag to remove
-
hasFlag
Checks whether the entity has the given flag- Parameters:
entity
- the entity to check forflag
- the flag to check for- Returns:
- true if the flag is active on the entity, false otherwise
-
getTimeLeft
Retrieves the time left on a flag for an entity- Parameters:
entity
- entity to get the time forflag
- flag to get the time for- Returns:
- time left on the flag in seconds for the entity
-
clearFlags
public static void clearFlags(org.bukkit.entity.LivingEntity entity) Clears the flags for an entity- Parameters:
entity
- entity to clear the flags for
-