Class PotionEffectProvider<T>
java.lang.Object
org.skriptlang.skript.bukkit.potion.providers.PotionEffectProvider<T>
- Type Parameters:
T- The type providing potion effects.
- Direct Known Subclasses:
NullProvider
A wrapper for working with objects that provide potion effects.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDescribes the type of potion effects being retrieved in a retrieval operation. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidadd(org.bukkit.potion.PotionEffect potionEffect) Adds a potion effect to this provider.abstract voidclear(org.bukkit.potion.PotionEffectType[] potionEffectTypes, PotionEffectProvider.RetrievalState state) Clears all potion effects ofpotionEffectTypesfrom this provider.abstract voidClears all potion effects from this provider.abstract Collection<SkriptPotionEffect> get(org.bukkit.potion.PotionEffectType[] potionEffectTypes, PotionEffectProvider.RetrievalState state) Obtains specific types of potion effects from this provider.abstract Collection<SkriptPotionEffect> Obtains all potion effects from this provider.abstract voidmirrorEffectChanges(SkriptPotionEffect potionEffect, Runnable runnable) Used for mirroring modifications of a potion effect actively applied to this provider.voidmodify(org.bukkit.potion.PotionEffectType[] types, PotionEffectProvider.RetrievalState state, Object[] delta, Changer.ChangeMode mode) Modifies properties of existing potion effects on this provider.static PotionEffectProvider<?> abstract voidremove(SkriptPotionEffect potionEffect, PotionEffectProvider.RetrievalState state) Removes a potion effect from this provider.abstract voidremoveAll(org.bukkit.potion.PotionEffectType potionEffectType, PotionEffectProvider.RetrievalState state) Removes all potion effects of a specific type from this provider.
-
Field Details
-
source
Source object providing potion effects.
-
-
Constructor Details
-
PotionEffectProvider
- Parameters:
source- The source object providing potion effects.
-
-
Method Details
-
of
- Parameters:
object- The object to obtain a provider from.errorProducer- A consumer to use for printing errors.- Returns:
- A provider wrapping
object. Ifobjectis not a known potion provider,errorProduceris invoked and a dummy provider is returned.
-
get
public abstract Collection<SkriptPotionEffect> get(org.bukkit.potion.PotionEffectType[] potionEffectTypes, PotionEffectProvider.RetrievalState state) Obtains specific types of potion effects from this provider.- Parameters:
potionEffectTypes- The type of potion effects to obtain.state- The type of retrieval to perform.- Returns:
- All potion effects of
potionEffectTypespresent on this provider.
-
getAll
Obtains all potion effects from this provider.- Parameters:
state- The type of retrieval to perform.- Returns:
- All potion effects present on this provider.
-
add
public abstract void add(org.bukkit.potion.PotionEffect potionEffect) Adds a potion effect to this provider.- Parameters:
potionEffect- The potion effect to add.
-
remove
public abstract void remove(SkriptPotionEffect potionEffect, PotionEffectProvider.RetrievalState state) Removes a potion effect from this provider. A potion effect only needs to match the qualities ofpotionEffectto be removed. Thus, an effect will be removed even if it has other, distinguishing qualities.- Parameters:
potionEffect- The potion effect to remove.state- State determining whether certain types of potion effects should be ignored.
-
removeAll
public abstract void removeAll(org.bukkit.potion.PotionEffectType potionEffectType, PotionEffectProvider.RetrievalState state) Removes all potion effects of a specific type from this provider.- Parameters:
potionEffectType- The type of potion effect to remove.state- State determining whether certain types of potion effects should be preserved.
-
clear
public abstract void clear(org.bukkit.potion.PotionEffectType[] potionEffectTypes, PotionEffectProvider.RetrievalState state) Clears all potion effects ofpotionEffectTypesfrom this provider.- Parameters:
potionEffectTypes- The types of potion effects to clear.state- State determining whether certain types of potion effects should be ignored.
-
clearAll
Clears all potion effects from this provider.- Parameters:
state- State determining whether certain types of potion effects should be preserved.
-
modify
public void modify(org.bukkit.potion.PotionEffectType[] types, PotionEffectProvider.RetrievalState state, Object[] delta, Changer.ChangeMode mode) Modifies properties of existing potion effects on this provider.- Parameters:
types- The types of potion effects to modify.state- State determining whether certain types of potion effects should be ignored.delta- The change values.mode- The type of modification to perform.
-
mirrorEffectChanges
Used for mirroring modifications of a potion effect actively applied to this provider.- Parameters:
potionEffect- The potion effect being modified.runnable- A runnable that applies the modification(s) topotionEffectwhen invoked.
-