Class O2SplashPotion
- Direct Known Subclasses:
HERBICIDE_POTION,WIGGENWELD_POTION
O2SplashPotion extends O2Potion to provide functionality specific to splash potions that are thrown rather than consumed directly. Splash potions affect a radius of entities when they impact and break, unlike normal potions which are consumed by a player drinking them.
Subclasses must implement doOnPotionSplashEvent(PotionSplashEvent) to define the
custom effects that occur when the splash potion explodes. The potion material type is
automatically set to Material.SPLASH_POTION.
Examples of splash potions include HERBICIDE_POTION which kills plants in a radius and damages plant-based entities when thrown.
- Since:
- 2.2.7
-
Field Summary
Fields inherited from class net.pottercraft.ollivanders2.potion.O2Potion
duration, flavorText, ingredients, potionColor, potionSuccessMessage, potionType, text, usesModifier -
Constructor Summary
ConstructorsConstructorDescriptionO2SplashPotion(@NotNull Ollivanders2 plugin) Constructor for O2SplashPotion. -
Method Summary
Modifier and TypeMethodDescriptionabstract voiddoOnPotionSplashEvent(@NotNull org.bukkit.event.entity.PotionSplashEvent event) Handle the effects that occur when this splash potion is thrown and impacts.Methods inherited from class net.pottercraft.ollivanders2.potion.O2Potion
brew, brewBadPotion, checkRecipe, createPotionItemStack, drink, getFlavorText, getIngredients, getIngredientsText, getLevel, getMagicBranch, getName, getPotionSuccessMessage, getPotionType, getText, setUsesModifier
-
Constructor Details
-
O2SplashPotion
Constructor for O2SplashPotion.Initializes the splash potion by calling the parent O2Potion constructor and setting the potion material type to
Material.SPLASH_POTION. Subclasses should call this constructor viasuper(plugin)and then set up their specific recipe, ingredients, effects, and other potion properties.- Parameters:
plugin- a callback to the plugin instance
-
-
Method Details
-
doOnPotionSplashEvent
public abstract void doOnPotionSplashEvent(@NotNull @NotNull org.bukkit.event.entity.PotionSplashEvent event) Handle the effects that occur when this splash potion is thrown and impacts.This abstract method is called when the splash potion breaks and its effects are applied. Subclasses must implement this method to define their custom splash effects, such as:
- Modifying the intensity of the potion effect for different entity types
- Creating stationary spells or effects at the splash location
- Applying custom transformations or interactions to affected entities
The PotionSplashEvent contains information about the potion, thrower, splash location, affected entities, and the original potion effect intensity that can be modified.
- Parameters:
event- the splash potion event containing splash location, affected entities, and effect intensity
-