Class FlagData
java.lang.Object
studio.magemonkey.fabled.api.util.FlagData
Represents flags set on an entity
-
Constructor Summary
ConstructorsConstructorDescriptionFlagData
(org.bukkit.entity.LivingEntity entity) Initializes new flag data for the entity -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a flag to the entity for the given number of ticksvoid
clear()
Clears all flags on the entity and stops associated tasks.flagList()
Check the list of all active flagsint
getMillisLeft
(String flag) Retrieves the number of milliseconds left of an active flag on the entity.int
getSecondsLeft
(String flag) Retrieves the number of seconds left of an active flag on the entity.boolean
Checks whether the entity currently has the flag setvoid
removeFlag
(String flag) Removes a flag from the entity
-
Constructor Details
-
FlagData
public FlagData(org.bukkit.entity.LivingEntity entity) Initializes new flag data for the entity- Parameters:
entity
- entity to initialize for
-
-
Method Details
-
addFlag
Adds a flag to the entity for the given number of ticks- Parameters:
flag
- flag to setticks
- number of ticks to set the flag for
-
removeFlag
Removes a flag from the entity- Parameters:
flag
- flag to remove from the entity
-
clear
public void clear()Clears all flags on the entity and stops associated tasks. -
getSecondsLeft
Retrieves the number of seconds left of an active flag on the entity. If the flag is not active, this will instead return 0.- Parameters:
flag
- flag to check the time left for- Returns:
- the seconds left rounded up to the nearest second or 0 if not set
-
getMillisLeft
Retrieves the number of milliseconds left of an active flag on the entity. If the flag is not active, this will instead return 0.- Parameters:
flag
- flag to check the time left for- Returns:
- the number of milliseconds left or 0 if not set
-
hasFlag
Checks whether the entity currently has the flag set- Parameters:
flag
- the flag to check if set or not- Returns:
- true if set, false otherwise
-
flagList
Check the list of all active flags- Returns:
- Set name of all active flag.
-