Class FlagManager

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

public class FlagManager extends Object
The manager for temporary entity flag data
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addFlag(org.bukkit.entity.LivingEntity entity, String flag, int ticks)
    Adds a flag to an entity
    static void
    clearFlags(org.bukkit.entity.LivingEntity entity)
    Clears the flags for an entity
    static 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 entity
    static boolean
    hasFlag(org.bukkit.entity.LivingEntity entity, String flag)
    Checks whether the entity has the given flag
    static void
    removeFlag(org.bukkit.entity.LivingEntity entity, String flag)
    Removes the flag from an entity

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FlagManager

      public FlagManager()
  • Method Details

    • getFlagData

      public static FlagData getFlagData(org.bukkit.entity.LivingEntity entity)
      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

      public 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. If set to false, this will return null if no data currently exists.
      Parameters:
      entity - entity to get the flag data for
      create - whether to create new data if it doesn't exist
      Returns:
      the flag data for an enemy
    • addFlag

      public static void addFlag(org.bukkit.entity.LivingEntity entity, String flag, int ticks)
      Adds a flag to an entity
      Parameters:
      entity - entity to add the flag to
      flag - the flag to add
      ticks - the duration to add the flag for
    • removeFlag

      public static void removeFlag(org.bukkit.entity.LivingEntity entity, String flag)
      Removes the flag from an entity
      Parameters:
      entity - entity to remove the flag from
      flag - flag to remove
    • hasFlag

      public static boolean hasFlag(org.bukkit.entity.LivingEntity entity, String flag)
      Checks whether the entity has the given flag
      Parameters:
      entity - the entity to check for
      flag - the flag to check for
      Returns:
      true if the flag is active on the entity, false otherwise
    • getTimeLeft

      public static int getTimeLeft(org.bukkit.entity.LivingEntity entity, String flag)
      Retrieves the time left on a flag for an entity
      Parameters:
      entity - entity to get the time for
      flag - 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