Class ThrownPotionData

java.lang.Object
ch.njol.skript.entity.EntityData<org.bukkit.entity.ThrownPotion>
ch.njol.skript.entity.ThrownPotionData
All Implemented Interfaces:
SyntaxElement, YggdrasilSerializable, YggdrasilSerializable.YggdrasilExtendedSerializable

public class ThrownPotionData extends EntityData<org.bukkit.entity.ThrownPotion>
  • Constructor Details

    • ThrownPotionData

      public ThrownPotionData()
  • Method Details

    • init

      protected boolean init(Literal<?>[] exprs, int matchedPattern, SkriptParser.ParseResult parseResult)
      Description copied from class: EntityData
      Initializes this EntityData from the matched pattern and its associated literals.

      This is used when parsing entity data from user-written patterns such as "a saddled pig".

      Specified by:
      init in class EntityData<org.bukkit.entity.ThrownPotion>
      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.
      matchedPattern - The index of the pattern which matched.
      parseResult - Additional information from the parser.
      Returns:
      true if initialization was successful, otherwise false.
    • init

      protected boolean init(@Nullable @Nullable Class<? extends org.bukkit.entity.ThrownPotion> c, @Nullable @Nullable org.bukkit.entity.ThrownPotion e)
      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<org.bukkit.entity.ThrownPotion>
      Parameters:
      c - An entity's class, e.g. Player
      e - An actual entity, or null to get an entity data for an entity class
      Returns:
      true if initialization was successful, otherwise false.
    • match

      protected boolean match(org.bukkit.entity.ThrownPotion entity)
      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<org.bukkit.entity.ThrownPotion>
      Parameters:
      entity - The Entity to match.
      Returns:
      true if the entity matches, otherwise false.
    • spawn

      @Nullable public @Nullable org.bukkit.entity.ThrownPotion spawn(org.bukkit.Location location, @Nullable @Nullable Consumer<org.bukkit.entity.ThrownPotion> consumer)
      Description copied from class: EntityData
      Spawn this entity data at a location. The consumer allows for modification to the entity before it actually gets spawned.
      Overrides:
      spawn in class EntityData<org.bukkit.entity.ThrownPotion>
      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.
    • set

      public void set(org.bukkit.entity.ThrownPotion entity)
      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<org.bukkit.entity.ThrownPotion>
      Parameters:
      entity - The spawned entity.
    • getType

      public Class<? extends org.bukkit.entity.ThrownPotion> getType()
      Description copied from class: EntityData
      Returns the Class of the Entity that this EntityData represents or handles.
      Specified by:
      getType in class EntityData<org.bukkit.entity.ThrownPotion>
      Returns:
      The entity's Class, such as Pig.class.
    • getSuperType

      @NotNull public @NotNull EntityData getSuperType()
      Description copied from class: EntityData
      Returns a more general version of this EntityData with specific data removed.

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

      Specified by:
      getSuperType in class EntityData<org.bukkit.entity.ThrownPotion>
      Returns:
      A generalized EntityData representing the base entity type.
    • isSupertypeOf

      public boolean isSupertypeOf(EntityData<?> e)
      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<org.bukkit.entity.ThrownPotion>
      Parameters:
      e - 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)
      Overrides:
      toString in class EntityData<org.bukkit.entity.ThrownPotion>
    • deserialize

      @Deprecated(since="2.3.0", forRemoval=true) protected boolean deserialize(String s)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Overrides:
      deserialize in class EntityData<org.bukkit.entity.ThrownPotion>
    • equals_i

      protected boolean equals_i(EntityData<?> obj)
      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<org.bukkit.entity.ThrownPotion>
      Parameters:
      obj - The EntityData to compare with.
      Returns:
      true if the data is considered equal, 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<org.bukkit.entity.ThrownPotion>
      Returns:
      A hash code representing subclass-specific data.