Class FlagData

java.lang.Object
studio.magemonkey.fabled.api.util.FlagData

public class FlagData extends Object
Represents flags set on an entity
  • Constructor Summary

    Constructors
    Constructor
    Description
    FlagData(org.bukkit.entity.LivingEntity entity)
    Initializes new flag data for the entity
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addFlag(String flag, int ticks)
    Adds a flag to the entity for the given number of ticks
    void
    Clears all flags on the entity and stops associated tasks.
    Check the list of all active flags
    int
    Retrieves the number of milliseconds left of an active flag on the entity.
    int
    Retrieves the number of seconds left of an active flag on the entity.
    boolean
    Checks whether the entity currently has the flag set
    void
    Removes a flag from the entity

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public void addFlag(String flag, int ticks)
      Adds a flag to the entity for the given number of ticks
      Parameters:
      flag - flag to set
      ticks - number of ticks to set the flag for
    • removeFlag

      public void removeFlag(String flag)
      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

      public int getSecondsLeft(String flag)
      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

      public int getMillisLeft(String flag)
      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

      public boolean hasFlag(String flag)
      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

      public Set<String> flagList()
      Check the list of all active flags
      Returns:
      Set name of all active flag.