Class EntityData<E extends org.bukkit.entity.Entity>

java.lang.Object
ch.njol.skript.entity.EntityData<E>
All Implemented Interfaces:
SyntaxElement, YggdrasilSerializable, YggdrasilSerializable.YggdrasilExtendedSerializable
Direct Known Subclasses:
EntityData

@Deprecated(forRemoval=true, since="2.17") public abstract class EntityData<E extends org.bukkit.entity.Entity> extends Object implements SyntaxElement, YggdrasilSerializable.YggdrasilExtendedSerializable
Deprecated, for removal: This API element is subject to removal in a future version.
Use EntityData instead.
  • Nested Class Summary

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract boolean
    canSpawn(@Nullable org.bukkit.World world)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Checks whether this entity type is allowed to spawn in the given World.
    abstract E
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates an entity in the server but does not spawn it
    abstract E
    create(org.bukkit.Location location)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates an entity at the provided location, but does not spawn it NOTE: If RegionAccessor.createEntity(Location, Class) does not exist, will return spawn(Location)
    abstract void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Deserializes this object.
    abstract boolean
    equals(@Nullable Object obj)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    static <E extends org.bukkit.entity.Entity>
    EntityData<? super E>
    fromClass(Class<E> entityClass)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates an EntityData that represents the given entity class.
    static <E extends org.bukkit.entity.Entity>
    EntityData<? super E>
    fromEntity(E entity)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates an EntityData that represents the given entity instance.
    static <E extends org.bukkit.entity.Entity>
    E[]
    getAll(EntityData<?>[] types, Class<E> type, org.bukkit.Chunk[] chunks)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    static <E extends org.bukkit.entity.Entity>
    E[]
    getAll(EntityData<?>[] types, Class<E> type, org.bukkit.World @Nullable [] worlds)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    abstract E[]
    getAll(org.bukkit.World... worlds)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    abstract @NotNull EntityData<?>
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns a more general version of this EntityData with specific data removed.
    abstract @NotNull String
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    abstract Class<? extends E>
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the Class of the Entity that this EntityData represents or handles.
    abstract int
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    abstract Kleenean
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    abstract boolean
    isInstance(@Nullable org.bukkit.entity.Entity entity)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    abstract Kleenean
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    abstract boolean
    isSupertypeOf(EntityData<?> entityData)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Determines whether this EntityData is a supertype of the given entityData.
    static @Nullable EntityData<?>
    parse(String string)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Prints errors.
    static @Nullable EntityData<?>
    Deprecated, for removal: This API element is subject to removal in a future version.
    Prints errors.
    abstract Fields
    Deprecated, for removal: This API element is subject to removal in a future version.
    Serialises this object.
    abstract void
    set(E entity)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Applies this EntityData to a newly spawned Entity.
    abstract E
    spawn(org.bukkit.Location location)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Spawn this entity data at a location.
    abstract E
    spawn(org.bukkit.Location location, @Nullable Consumer<E> consumer)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Spawn this entity data at a location.
    abstract String
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    abstract String
    toString(int flags)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    static String
    toString(Class<? extends org.bukkit.entity.Entity> entityClass)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    static String
    toString(Class<? extends org.bukkit.entity.Entity> entityClass, int flags)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    static String
    toString(org.bukkit.entity.Entity entity)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    static String
    toString(org.bukkit.entity.Entity entity, int flags)
    Deprecated, for removal: This API element is subject to removal in a future version.
     

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface SyntaxElement

    getParser, init, preInit
  • Field Details

    • LANGUAGE_NODE

      public static final String LANGUAGE_NODE
      Deprecated, for removal: This API element is subject to removal in a future version.
      See Also:
    • serializer

      public static Serializer<EntityData> serializer
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Constructor Details

    • EntityData

      public EntityData()
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • parse

      @Nullable public static @Nullable EntityData<?> parse(String string)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Prints errors.
      Parameters:
      string - String with optional indefinite article at the beginning
      Returns:
      The parsed entity data
    • parseWithoutIndefiniteArticle

      @Nullable public static @Nullable EntityData<?> parseWithoutIndefiniteArticle(String string)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Prints errors.
      Parameters:
      string -
      Returns:
      The parsed entity data
    • getAll

      public static <E extends org.bukkit.entity.Entity> E[] getAll(EntityData<?>[] types, Class<E> type, org.bukkit.World @Nullable [] worlds)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Parameters:
      types -
      type -
      worlds - worlds or null for all
      Returns:
      All entities of this type in the given worlds
    • getAll

      public static <E extends org.bukkit.entity.Entity> E[] getAll(EntityData<?>[] types, Class<E> type, org.bukkit.Chunk[] chunks)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • fromClass

      public static <E extends org.bukkit.entity.Entity> EntityData<? super E> fromClass(Class<E> entityClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates an EntityData that represents the given entity class.
      Parameters:
      entityClass - The class of the entity (e.g. Pig.class).
      Returns:
      An EntityData representing the provided class.
    • fromEntity

      public static <E extends org.bukkit.entity.Entity> EntityData<? super E> fromEntity(E entity)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates an EntityData that represents the given entity instance.
      Parameters:
      entity - The entity to represent.
      Returns:
      An EntityData representing the provided entity.
    • toString

      public static String toString(org.bukkit.entity.Entity entity)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • toString

      public static String toString(Class<? extends org.bukkit.entity.Entity> entityClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • toString

      public static String toString(org.bukkit.entity.Entity entity, int flags)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • toString

      public static String toString(Class<? extends org.bukkit.entity.Entity> entityClass, int flags)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • set

      public abstract void set(E entity)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Applies this EntityData to a newly spawned Entity.

      This is used during entity spawning to set additional data, such as a saddled pig.

      Parameters:
      entity - The spawned entity.
    • getType

      public abstract Class<? extends E> getType()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the Class of the Entity that this EntityData represents or handles.
      Returns:
      The entity's Class, such as Pig.class.
    • getSuperType

      @NotNull public abstract @NotNull EntityData<?> getSuperType()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns a more general version of this EntityData with specific data removed.

      For example, calling this on "a saddled pig" should return "a pig". This is typically used to obtain the base entity type without any modifiers or traits.

      Returns:
      A generalized EntityData representing the base entity type.
    • toString

      public abstract String toString()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Overrides:
      toString in class Object
    • toString

      public abstract String toString(int flags)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • isPlural

      public abstract Kleenean isPlural()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns:
      Kleenean determining whether this EntityData is representing plurality.
    • isBaby

      public abstract Kleenean isBaby()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns:
      Kleenean determining whether this EntityData is representing baby type.
    • hashCode

      public abstract int hashCode()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Overrides:
      hashCode in class Object
    • equals

      public abstract boolean equals(@Nullable @Nullable Object obj)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Overrides:
      equals in class Object
    • canSpawn

      public abstract boolean canSpawn(@Nullable @Nullable org.bukkit.World world)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Checks whether this entity type is allowed to spawn in the given World.

      Some entity types may be restricted from spawning due to experimental datapacks.

      Parameters:
      world - The world to check spawning permissions in.
      Returns:
      true if the entity can be spawned in the given world, or in general if world is null; otherwise false.
    • spawn

      @Nullable public abstract E spawn(org.bukkit.Location location)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Spawn this entity data at a location.
      Parameters:
      location - The Location to spawn the entity at.
      Returns:
      The Entity object that is spawned.
    • spawn

      @Nullable public abstract E spawn(org.bukkit.Location location, @Nullable @Nullable Consumer<E> consumer)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Spawn this entity data at a location. The consumer allows for modification to the entity before it actually gets spawned.
      Parameters:
      location - The Location to spawn the entity at.
      consumer - A Consumer to apply the entity changes to.
      Returns:
      The Entity object that is spawned.
    • getAll

      public abstract E[] getAll(org.bukkit.World... worlds)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • isInstance

      public abstract boolean isInstance(@Nullable @Nullable org.bukkit.entity.Entity entity)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • isSupertypeOf

      public abstract boolean isSupertypeOf(EntityData<?> entityData)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Determines whether this EntityData is a supertype of the given entityData.

      This is used to check whether the current entity data represents a broader category than another. For example:

              
                  if a zombie is a monster:    # passes: "monster" is a supertype of "zombie"
                  if a monster is a zombie:    # fails: "zombie" is not a supertype of "monster"
              
          

      Parameters:
      entityData - The EntityData to compare against.
      Returns:
      true if this is a supertype of the given entity data, otherwise false.
    • serialize

      public abstract Fields serialize() throws NotSerializableException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: YggdrasilSerializable.YggdrasilExtendedSerializable
      Serialises this object. Only fields contained in the returned Fields object will be written to stream.

      You can use return new Fields(this); to emulate the default behaviour.

      Specified by:
      serialize in interface YggdrasilSerializable.YggdrasilExtendedSerializable
      Returns:
      A Fields object containing all fields that should be written to stream
      Throws:
      NotSerializableException - If this object or one of its fields is not serializable
    • deserialize

      public abstract void deserialize(Fields fields) throws StreamCorruptedException, NotSerializableException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: YggdrasilSerializable.YggdrasilExtendedSerializable
      Deserializes this object. No fields have been set when this method is called, use fields.setFields(this, yggdrasil) to set all compatible non-transient and non-static fields (and call incompatible/missing field handlers if applicable – this implies that errors will be thrown if the fields object is invalid).

      You can use fields.setFields(this); to emulate the default behaviour.

      Specified by:
      deserialize in interface YggdrasilSerializable.YggdrasilExtendedSerializable
      Parameters:
      fields - A Fields object containing all fields read from stream
      Throws:
      StreamCorruptedException - If the Fields object is invalid, i.e. was not written by YggdrasilSerializable.YggdrasilExtendedSerializable.serialize() or Yggdrasil's default serialisation.
      NotSerializableException
    • getSyntaxTypeName

      @NotNull public abstract @NotNull String getSyntaxTypeName()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getSyntaxTypeName in interface SyntaxElement
      Returns:
      A string naming the type of syntax this is. e.g. "expression", "section".
    • create

      @Nullable public abstract E create()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates an entity in the server but does not spawn it
      Returns:
      The created entity
    • create

      @Nullable public abstract E create(org.bukkit.Location location)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates an entity at the provided location, but does not spawn it NOTE: If RegionAccessor.createEntity(Location, Class) does not exist, will return spawn(Location)
      Parameters:
      location - The Location to create the entity at
      Returns:
      The created entity