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>
  • 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: EntityData
      Initializes this EntityData.

      As of Skript 2.13, code names can have multiple patterns. matchedGroup will be the index of the code name the matched pattern is linked to. (e.g. PigData "unsaddled pig" = 0, "pig" = 1, "saddled pig" = 2) matchedPattern will be the index of the pattern used from the patterns of the group.

      Specified by:
      init in class EntityData<T extends org.bukkit.entity.Entity & org.bukkit.material.Colorable>
      Parameters:
      exprs - An array of Literal expressions 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 of null.
      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:
      true if initialization was successful, otherwise false.
    • init

      protected boolean init(@Nullable @Nullable Class<? extends T> entityClass, @Nullable T colorable)
      Description copied from class: EntityData
      Initializes this EntityData from either an entity class or a specific Entity.

      Example usage:

                  
                      spawn a pig at location(0, 0, 0):
                              set {_entity} to event-entity
                      spawn {_entity} at location(0, 0, 0)
                  
              

      Specified by:
      init in class EntityData<T extends org.bukkit.entity.Entity & org.bukkit.material.Colorable>
      Parameters:
      entityClass - An entity's class, e.g. Player
      colorable - An actual entity, or null to get an entity data for an entity class
      Returns:
      true if initialization was successful, otherwise false.
    • set

      public void set(T colorable)
      Description copied from class: EntityData
      Applies this EntityData to a newly spawned Entity.

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

      Specified by:
      set in class EntityData<T extends org.bukkit.entity.Entity & org.bukkit.material.Colorable>
      Parameters:
      colorable - The spawned entity.
    • match

      protected boolean match(T colorable)
      Description copied from class: EntityData
      Determines whether the given Entity matches this EntityData data.

      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:
      match in class EntityData<T extends org.bukkit.entity.Entity & org.bukkit.material.Colorable>
      Parameters:
      colorable - The Entity to match.
      Returns:
      true if the entity matches, otherwise false.
    • hashCode_i

      protected int hashCode_i()
      Description copied from class: EntityData
      Internal method used by EntityData.hashCode() to include subclass-specific fields in the hash calculation for this EntityData.
      Specified by:
      hashCode_i in class EntityData<T extends org.bukkit.entity.Entity & org.bukkit.material.Colorable>
      Returns:
      A hash code representing subclass-specific data.
    • equals_i

      protected boolean equals_i(EntityData<?> entityData)
      Description copied from class: EntityData
      Internal helper for EntityData.equals(Object) to compare the specific data of this EntityData with another.
      Specified by:
      equals_i in class EntityData<T extends org.bukkit.entity.Entity & org.bukkit.material.Colorable>
      Parameters:
      entityData - The EntityData to compare with.
      Returns:
      true if the data is considered equal, otherwise false.
    • isSupertypeOf

      public boolean isSupertypeOf(EntityData<?> entityData)
      Description copied from class: EntityData
      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"
              
          

      Specified by:
      isSupertypeOf in class EntityData<T extends org.bukkit.entity.Entity & org.bukkit.material.Colorable>
      Parameters:
      entityData - The EntityData to compare against.
      Returns:
      true if this is a supertype of the given entity data, otherwise false.
    • toString

      public String toString(int flags)
      Description copied from class: EntityData
      Gets the string representation of this EntityData.
      Overrides:
      toString in class EntityData<T extends org.bukkit.entity.Entity & org.bukkit.material.Colorable>
      Parameters:
      flags - The flag to determine singular or plural.
      Returns:
      The string representation.