Class EntityType

java.lang.Object
ch.njol.skript.entity.EntityType
org.skriptlang.skript.bukkit.entity.EntityType
All Implemented Interfaces:
YggdrasilSerializable, Cloneable

public class EntityType extends EntityType implements Cloneable, YggdrasilSerializable
Class that represents x amount of an EntityData
  • Constructor Details

    • EntityType

      public EntityType()
      Only used for deserialisation
    • EntityType

      public EntityType(EntityData<?> data, int amount)
      Constructs a new EntityType.
      Parameters:
      data - The corresponding EntityData.
      amount - The amount of data.
  • Method Details

    • parse

      @Nullable public static @Nullable EntityType parse(String string)
      Parses the provided string into a EntityData and stores in a new EntityType.

      The string allows formats of "number + entity" and "article + entity", but never "article + number + entity" or "number + article + entity". Allowed: - 1 zombie, 3 pigs, 5 endermen - a zombie, a pig, an endermen Not-Allowed: - a 1 zombie, a 3 pigs, an 5 endermen - 1 a zombie, 3 a pigs, 5 an endermen

      Parameters:
      string - The String to parse.
      Returns:
      EntityType containing the parsed EntityData and provided amount if present in string or -1 if not present. Otherwise null if the parse failed.
    • isInstance

      public boolean isInstance(org.bukkit.entity.Entity entity)
      Whether entity is instance of this.
      Overrides:
      isInstance in class EntityType
      Parameters:
      entity - The Entity to check.
      Returns:
      true if instance of, otherwise false.
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class EntityType
    • toString

      public String toString(int flags)
      Returns the string representation of this.
      Overrides:
      toString in class EntityType
      Parameters:
      flags - The flags to determine singular or plurality.
      Returns:
      The string representation.
    • getAmount

      public int getAmount()
      Overrides:
      getAmount in class EntityType
      Returns:
      The amount of this corresponds to with data.
    • setAmount

      public void setAmount(int entityAmount)
      Sets the amount this corresponds to with data.
      Parameters:
      entityAmount - The new amount.
    • getData

      public EntityData<?> getData()
      Returns:
      The EntityData this corresponds to.
    • sameType

      public boolean sameType(EntityType other)
      Whether other has the same EntityData.
      Parameters:
      other - The other EntityType.
      Returns:
      true if the EntityDatas are the same, otherwise false.
      See Also:
    • clone

      public EntityType clone()
      Overrides:
      clone in class EntityType
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class EntityType
    • equals

      public boolean equals(@Nullable @Nullable Object obj)
      Overrides:
      equals in class EntityType