Class EntityType
java.lang.Object
ch.njol.skript.entity.EntityType
org.skriptlang.skript.bukkit.entity.EntityType
- All Implemented Interfaces:
YggdrasilSerializable, Cloneable
Class that represents x amount of an
EntityData-
Nested Class Summary
Nested classes/interfaces inherited from interface YggdrasilSerializable
YggdrasilSerializable.YggdrasilExtendedSerializable, YggdrasilSerializable.YggdrasilRobustEnum, YggdrasilSerializable.YggdrasilRobustSerializable -
Field Summary
Fields inherited from class EntityType
amount, newEntityType -
Constructor Summary
ConstructorsConstructorDescriptionOnly used for deserialisationEntityType(EntityData<?> data, int amount) Constructs a newEntityType. -
Method Summary
Modifier and TypeMethodDescriptionclone()booleanintEntityData<?> getData()inthashCode()booleanisInstance(org.bukkit.entity.Entity entity) Whetherentityis instance ofthis.static @Nullable EntityTypebooleansameType(EntityType other) Whetherotherhas the sameEntityData.voidsetAmount(int entityAmount) Sets the amountthiscorresponds to withdata.toString()toString(int flags) Returns the string representation ofthis.Methods inherited from class EntityType
sameType
-
Constructor Details
-
EntityType
public EntityType()Only used for deserialisation -
EntityType
Constructs a newEntityType.- Parameters:
data- The correspondingEntityData.amount- The amount ofdata.
-
-
Method Details
-
parse
Parses the providedstringinto aEntityDataand stores in a newEntityType.The
stringallows 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- TheStringto parse.- Returns:
EntityTypecontaining the parsedEntityDataand provided amount if present instringor -1 if not present. Otherwisenullif the parse failed.
-
isInstance
public boolean isInstance(org.bukkit.entity.Entity entity) Whetherentityis instance ofthis.- Overrides:
isInstancein classEntityType- Parameters:
entity- TheEntityto check.- Returns:
trueif instance of, otherwisefalse.- See Also:
-
toString
- Overrides:
toStringin classEntityType
-
toString
Returns the string representation ofthis.- Overrides:
toStringin classEntityType- Parameters:
flags- The flags to determine singular or plurality.- Returns:
- The string representation.
-
getAmount
public int getAmount()- Overrides:
getAmountin classEntityType- Returns:
- The amount of
thiscorresponds to withdata.
-
setAmount
public void setAmount(int entityAmount) Sets the amountthiscorresponds to withdata.- Parameters:
entityAmount- The new amount.
-
getData
- Returns:
- The
EntityDatathiscorresponds to.
-
sameType
Whetherotherhas the sameEntityData.- Parameters:
other- The otherEntityType.- Returns:
trueif theEntityDatas are the same, otherwisefalse.- See Also:
-
clone
- Overrides:
clonein classEntityType
-
hashCode
public int hashCode()- Overrides:
hashCodein classEntityType
-
equals
- Overrides:
equalsin classEntityType
-