Package ch.njol.skript.util
Class PotionEffectUtils
java.lang.Object
ch.njol.skript.util.PotionEffectUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addEffects(ItemType itemType, Object[] effects)
Add PotionEffects to an ItemTyestatic void
addEffects(org.bukkit.entity.LivingEntity entity, Object[] effects)
Add PotionEffects to an entitystatic @Nullable org.bukkit.potion.PotionType
checkPotionType(String name)
Checks if given string represents a known potion type and returns that type.static void
clearAllEffects(ItemType itemType)
Clear allPotionEffects
from an ItemTypestatic void
clearAllEffects(org.bukkit.entity.LivingEntity entity)
Clear all the activePotionEffects
from an Entitystatic @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 wellstatic String[]
getNames()
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 ItemTypestatic void
removeEffects(org.bukkit.entity.LivingEntity entity, Object[] effects)
Remove a PotionEffect from an entitystatic 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)
-
Method Details
-
parseType
-
parseByEffectType
public static @Nullable org.bukkit.potion.PotionEffectType parseByEffectType(org.bukkit.potion.PotionEffectType t) -
toString
-
toString
-
toString
-
getNames
-
guessData
public static short guessData(org.bukkit.entity.ThrownPotion p) -
checkPotionType
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 activePotionEffects
from an Entity- Parameters:
entity
- Entity to clear effects for
-
addEffects
Add PotionEffects to an entity- Parameters:
entity
- Entity to add effects toeffects
-PotionEffect
orPotionEffectType
to add
-
removeEffects
Remove a PotionEffect from an entity- Parameters:
entity
- Entity to remove effects foreffects
-PotionEffect
orPotionEffectType
to remove
-
clearAllEffects
Clear allPotionEffects
from an ItemType- Parameters:
itemType
- Item to remove effects from
-
addEffects
Add PotionEffects to an ItemTye- Parameters:
itemType
- Item to add effects toeffects
-PotionEffect
orPotionEffectType
to add
-
removeEffects
Remove a PotionEffect from an ItemType- Parameters:
itemType
- Item to remove effects fromeffects
-PotionEffect
orPotionEffectType
to remove
-
getEffects
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
-