Class O2SplashPotion

java.lang.Object
net.pottercraft.ollivanders2.potion.O2Potion
net.pottercraft.ollivanders2.potion.O2SplashPotion
Direct Known Subclasses:
HERBICIDE_POTION, WIGGENWELD_POTION

public abstract class O2SplashPotion extends O2Potion
Abstract base class for splash potion implementations.

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
  • Constructor Details

    • O2SplashPotion

      public O2SplashPotion(@NotNull @NotNull Ollivanders2 plugin)
      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 via super(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