From 2e64ac6d256b4dc258d434f83018edb5dd4efb14 Mon Sep 17 00:00:00 2001 From: Traks <58818927+traksag@users.noreply.github.com> Date: Thu, 15 Jul 2021 18:43:05 +0200 Subject: [PATCH] Revert projectile hit on splash (#3162) * Revert projectile hit on splash * Notes about potions splashing after hit cancelled --- .../bukkit/listener/ProjectileEventListener.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileEventListener.java index 1309bac19..9a28ab448 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileEventListener.java @@ -62,6 +62,13 @@ public class ProjectileEventListener implements Listener { this.plotAreaManager = plotAreaManager; } + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onLingeringPotionSplash(LingeringPotionSplashEvent event) { + // Cancelling projectile hit events still results in area effect clouds. + // We need to cancel the splash events to get rid of those. + onProjectileHit(event); + } + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onPotionSplash(PotionSplashEvent event) { ThrownPotion damager = event.getPotion(); @@ -78,6 +85,11 @@ public class ProjectileEventListener implements Listener { } if (count > 0 && count == event.getAffectedEntities().size()) { event.setCancelled(true); + } else { + // Cancelling projectile hit events still results in potions + // splashing in the world. We need to cancel the splash events to + // avoid that. + onProjectileHit(event); } }