Class EntityUtils

java.lang.Object
ch.njol.skript.bukkitutil.EntityUtils

public class EntityUtils extends Object
Utility class for quick Entity methods
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    getAge(org.bukkit.entity.Entity entity)
    Get the age of an ageable entity.
    static boolean
    isAdult(org.bukkit.entity.Entity entity)
    Quick method to check if entity is an adult.
    static boolean
    isAgeable(org.bukkit.entity.Entity entity)
    Check if an entity is ageable.
    static void
    setAdult(org.bukkit.entity.Entity entity)
    Quick method for making an entity an adult.
    static void
    setAge(org.bukkit.entity.Entity entity, int age)
    Set the age of an entity.
    static void
    setBaby(org.bukkit.entity.Entity entity)
    Quick method for making an entity a baby.
    static void
    teleport(org.bukkit.entity.Entity entity, org.bukkit.Location location)
    Teleports the given entity to the given location.
    static org.bukkit.entity.EntityType
    Convert from Skript's EntityData to Bukkit's EntityType
    static EntityData<?>
    toSkriptEntityData(org.bukkit.entity.EntityType e)
    Convert from Bukkit's EntityType to Skript's EntityData

    Methods inherited from class java.lang.Object

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

    • EntityUtils

      public EntityUtils()
  • Method Details

    • isAgeable

      public static boolean isAgeable(org.bukkit.entity.Entity entity)
      Check if an entity is ageable. Some entities, such as zombies, do not have an age but can be a baby/adult.
      Parameters:
      entity - Entity to check
      Returns:
      True if entity is ageable
    • getAge

      public static int getAge(org.bukkit.entity.Entity entity)
      Get the age of an ageable entity. Entities such as zombies do not have an age, this will return -1 if baby, 0 if adult.
      Parameters:
      entity - Entity to grab age for
      Returns:
      Age of entity (if zombie/piglin/zoglin -1 = baby, 0 = adult) (if not ageable, will return 0)
    • setAge

      public static void setAge(org.bukkit.entity.Entity entity, int age)
      Set the age of an entity. Entities such as zombies do not have an age, setting below 0 will make them a baby otherwise adult.
      Parameters:
      entity - Entity to set age for
      age - Age to set
    • setBaby

      public static void setBaby(org.bukkit.entity.Entity entity)
      Quick method for making an entity a baby. Ageable entities (such as sheep or pigs) will set their default baby age to -24000.
      Parameters:
      entity - Entity to make baby
    • setAdult

      public static void setAdult(org.bukkit.entity.Entity entity)
      Quick method for making an entity an adult.
      Parameters:
      entity - Entity to make adult
    • isAdult

      public static boolean isAdult(org.bukkit.entity.Entity entity)
      Quick method to check if entity is an adult.
      Parameters:
      entity - Entity to check
      Returns:
      True if entity is an adult
    • toBukkitEntityType

      public static org.bukkit.entity.EntityType toBukkitEntityType(EntityData<?> e)
      Convert from Skript's EntityData to Bukkit's EntityType
      Parameters:
      e - Skript's EntityData
      Returns:
      Bukkit's EntityType
    • toSkriptEntityData

      public static EntityData<?> toSkriptEntityData(org.bukkit.entity.EntityType e)
      Convert from Bukkit's EntityType to Skript's EntityData
      Parameters:
      e - Bukkit's EntityType
      Returns:
      Skript's EntityData
    • teleport

      public static void teleport(org.bukkit.entity.Entity entity, org.bukkit.Location location)
      Teleports the given entity to the given location. Teleports to the given location in the entity's world if the location's world is null.