Class ColorableEntityData<T extends org.bukkit.entity.Entity & org.bukkit.material.Colorable>
java.lang.Object
ch.njol.skript.entity.EntityData<T>
org.skriptlang.skript.bukkit.entity.EntityData<T>
org.skriptlang.skript.bukkit.entity.data.ColorableEntityData<T>
- All Implemented Interfaces:
SyntaxElement, YggdrasilSerializable, YggdrasilSerializable.YggdrasilExtendedSerializable
- Direct Known Subclasses:
CushionData, ShulkerData
public abstract class ColorableEntityData<T extends org.bukkit.entity.Entity & org.bukkit.material.Colorable>
extends EntityData<T>
-
Nested Class Summary
Nested classes/interfaces inherited from class EntityData
EntityData.EntityDataPatterns<Data>, EntityData.PatternGroup<Data>Nested classes/interfaces inherited from interface YggdrasilSerializable
YggdrasilSerializable.YggdrasilExtendedSerializable, YggdrasilSerializable.YggdrasilRobustEnum, YggdrasilSerializable.YggdrasilRobustSerializable -
Field Summary
FieldsFields inherited from class EntityData
AGE_ADULT, AGE_BABY, AGE_PATTERN, groupIndexFields inherited from class EntityData
LANGUAGE_NODE, serializer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanequals_i(EntityData<?> entityData) Internal helper forEntityData.equals(Object)to compare the specific data of thisEntityDatawith another.protected intInternal method used byEntityData.hashCode()to include subclass-specific fields in the hash calculation for thisEntityData.protected booleaninit(Literal<?>[] exprs, int matchedGroup, int matchedPattern, SkriptParser.ParseResult parseResult) Initializes thisEntityData.protected booleanInitializes thisEntityDatafrom either an entity class or a specificEntity.booleanisSupertypeOf(EntityData<?> entityData) Determines whether thisEntityDatais a supertype of the givenentityData.protected booleanDetermines whether the givenEntitymatches thisEntityDatadata.voidApplies thisEntityDatato a newly spawnedEntity.toString(int flags) Gets the string representation of thisEntityData.Methods inherited from class EntityData
canSpawn, create, create, create, dataMatch, deserialize, equals, fromClass, fromEntity, getAgeNoun, getAll, getAll, getAll, getInfo, getInfo, getName, getSuperType, getSyntaxTypeName, getType, hashCode, infoBuilder, init, isBaby, isInstance, isPlural, isRegistered, isSupertypeOf, kleeneanMatch, kleeneanMatch, onRegistrationStop, parse, parseWithoutIndefiniteArticle, registerInfo, serialize, spawn, spawn, spawn, toString, toString, toString, toString, toStringMethods inherited from class EntityData
getAll, getAllMethods inherited from interface SyntaxElement
getParser, preInit
-
Field Details
-
color
@Nullable protected @Nullable org.bukkit.DyeColor color
-
-
Constructor Details
-
ColorableEntityData
public ColorableEntityData() -
ColorableEntityData
public ColorableEntityData(@Nullable @Nullable org.bukkit.DyeColor color)
-
-
Method Details
-
init
protected boolean init(Literal<?>[] exprs, int matchedGroup, int matchedPattern, SkriptParser.ParseResult parseResult) Description copied from class:EntityDataInitializes thisEntityData.As of Skript 2.13, code names can have multiple patterns.
matchedGroupwill be the index of the code name the matched pattern is linked to. (e.g.PigData"unsaddled pig" = 0, "pig" = 1, "saddled pig" = 2)matchedPatternwill be the index of the pattern used from the patterns of the group.- Specified by:
initin classEntityData<T extends org.bukkit.entity.Entity & org.bukkit.material.Colorable>- Parameters:
exprs- An array ofLiteralexpressions from the matched pattern, in the order they appear. If an optional value was omitted by the user, it will still be present in the array with a value ofnull.matchedGroup- The index of the group which matched.matchedPattern- The index of the pattern of the group which matched.parseResult- Additional information from the parser.- Returns:
trueif initialization was successful, otherwisefalse.
-
init
Description copied from class:EntityDataInitializes thisEntityDatafrom either an entity class or a specificEntity.Example usage:
spawn a pig at location(0, 0, 0): set {_entity} to event-entity spawn {_entity} at location(0, 0, 0)- Specified by:
initin classEntityData<T extends org.bukkit.entity.Entity & org.bukkit.material.Colorable>- Parameters:
entityClass- An entity's class, e.g. Playercolorable- An actual entity, or null to get an entity data for an entity class- Returns:
trueif initialization was successful, otherwisefalse.
-
set
Description copied from class:EntityDataApplies thisEntityDatato a newly spawnedEntity.This is used during entity spawning to set additional data, such as a saddled pig.
- Specified by:
setin classEntityData<T extends org.bukkit.entity.Entity & org.bukkit.material.Colorable>- Parameters:
colorable- The spawned entity.
-
match
Description copied from class:EntityDataDetermines whether the givenEntitymatches thisEntityDatadata.For example:
spawn a pig at location(0, 0, 0): set {_entity} to event-entity if {_entity} is a pig: # will pass if {_entity} is a saddled pig: # will not pass- Specified by:
matchin classEntityData<T extends org.bukkit.entity.Entity & org.bukkit.material.Colorable>- Parameters:
colorable- TheEntityto match.- Returns:
trueif the entity matches, otherwisefalse.
-
hashCode_i
protected int hashCode_i()Description copied from class:EntityDataInternal method used byEntityData.hashCode()to include subclass-specific fields in the hash calculation for thisEntityData.- Specified by:
hashCode_iin classEntityData<T extends org.bukkit.entity.Entity & org.bukkit.material.Colorable>- Returns:
- A hash code representing subclass-specific data.
-
equals_i
Description copied from class:EntityDataInternal helper forEntityData.equals(Object)to compare the specific data of thisEntityDatawith another.- Specified by:
equals_iin classEntityData<T extends org.bukkit.entity.Entity & org.bukkit.material.Colorable>- Parameters:
entityData- TheEntityDatato compare with.- Returns:
trueif the data is considered equal, otherwisefalse.
-
isSupertypeOf
Description copied from class:EntityDataDetermines whether thisEntityDatais a supertype of the givenentityData.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"- Specified by:
isSupertypeOfin classEntityData<T extends org.bukkit.entity.Entity & org.bukkit.material.Colorable>- Parameters:
entityData- TheEntityDatato compare against.- Returns:
trueif this is a supertype of the given entity data, otherwisefalse.
-
toString
Description copied from class:EntityDataGets the string representation of thisEntityData.- Overrides:
toStringin classEntityData<T extends org.bukkit.entity.Entity & org.bukkit.material.Colorable>- Parameters:
flags- The flag to determine singular or plural.- Returns:
- The string representation.
-