Class PotionEffectUtils

java.lang.Object
ch.njol.skript.util.PotionEffectUtils

public abstract class PotionEffectUtils extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addEffects​(ItemType itemType, Object[] effects)
    Add PotionEffects to an ItemTye
    static void
    addEffects​(org.bukkit.entity.LivingEntity entity, Object[] effects)
    Add PotionEffects to an entity
    static @Nullable org.bukkit.potion.PotionType
    Checks if given string represents a known potion type and returns that type.
    static void
    Clear all PotionEffects from an ItemType
    static void
    clearAllEffects​(org.bukkit.entity.LivingEntity entity)
    Clear all the active PotionEffects from an Entity
    static @Nullable org.bukkit.potion.PotionType
    effectToType​(org.bukkit.potion.PotionEffectType effect)
    Wrapper around deprecated API function, in case it gets removed.
    static List<org.bukkit.potion.PotionEffect>
    getEffects​(ItemType itemType)
    Get all the PotionEffects of an ItemType This will also include the base potion as well
    static String[]
     
    static String
    getPotionName​(@Nullable org.bukkit.potion.PotionEffectType effect, boolean extended, boolean strong)
    Get potion string representation.
    static short
    guessData​(org.bukkit.entity.ThrownPotion p)
     
    static @Nullable org.bukkit.potion.PotionEffectType
    parseByEffectType​(org.bukkit.potion.PotionEffectType t)
     
    static @Nullable org.bukkit.potion.PotionEffectType
     
    static void
    removeEffects​(ItemType itemType, Object[] effects)
    Remove a PotionEffect from an ItemType
    static void
    removeEffects​(org.bukkit.entity.LivingEntity entity, Object[] effects)
    Remove a PotionEffect from an entity
    static String
    toString​(org.bukkit.potion.PotionEffect potionEffect)
     
    static String
    toString​(org.bukkit.potion.PotionEffectType t)
     
    static String
    toString​(org.bukkit.potion.PotionEffectType t, int flags)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • parseType

      public static @Nullable org.bukkit.potion.PotionEffectType parseType(String s)
    • parseByEffectType

      public static @Nullable org.bukkit.potion.PotionEffectType parseByEffectType(org.bukkit.potion.PotionEffectType t)
    • toString

      public static String toString(org.bukkit.potion.PotionEffectType t)
    • toString

      public static String toString(org.bukkit.potion.PotionEffectType t, int flags)
    • toString

      public static String toString(org.bukkit.potion.PotionEffect potionEffect)
    • getNames

      public static String[] getNames()
    • guessData

      public static short guessData(org.bukkit.entity.ThrownPotion p)
    • checkPotionType

      public static @Nullable org.bukkit.potion.PotionType checkPotionType(String name)
      Checks if given string represents a known potion type and returns that type. Unused currently, will be used soon (TM).
      Parameters:
      name - Name of potion type
      Returns:
    • effectToType

      public static @Nullable org.bukkit.potion.PotionType effectToType(org.bukkit.potion.PotionEffectType effect)
      Wrapper around deprecated API function, in case it gets removed. Changing one method is easier that changing loads of them from different expressions.
      Parameters:
      effect - Type.
      Returns:
      Potion type.
    • getPotionName

      public static String getPotionName(@Nullable org.bukkit.potion.PotionEffectType effect, boolean extended, boolean strong)
      Get potion string representation.
      Parameters:
      effect -
      extended -
      strong -
      Returns:
    • clearAllEffects

      public static void clearAllEffects(org.bukkit.entity.LivingEntity entity)
      Clear all the active PotionEffects from an Entity
      Parameters:
      entity - Entity to clear effects for
    • addEffects

      public static void addEffects(org.bukkit.entity.LivingEntity entity, Object[] effects)
      Add PotionEffects to an entity
      Parameters:
      entity - Entity to add effects to
      effects - PotionEffect or PotionEffectType to add
    • removeEffects

      public static void removeEffects(org.bukkit.entity.LivingEntity entity, Object[] effects)
      Remove a PotionEffect from an entity
      Parameters:
      entity - Entity to remove effects for
      effects - PotionEffect or PotionEffectType to remove
    • clearAllEffects

      public static void clearAllEffects(ItemType itemType)
      Clear all PotionEffects from an ItemType
      Parameters:
      itemType - Item to remove effects from
    • addEffects

      public static void addEffects(ItemType itemType, Object[] effects)
      Add PotionEffects to an ItemTye
      Parameters:
      itemType - Item to add effects to
      effects - PotionEffect or PotionEffectType to add
    • removeEffects

      public static void removeEffects(ItemType itemType, Object[] effects)
      Remove a PotionEffect from an ItemType
      Parameters:
      itemType - Item to remove effects from
      effects - PotionEffect or PotionEffectType to remove
    • getEffects

      public static List<org.bukkit.potion.PotionEffect> getEffects(ItemType itemType)
      Get all the PotionEffects of an ItemType This will also include the base potion as well
      Parameters:
      itemType - Item to get potions from
      Returns:
      List of PotionEffects on the item