Revert projectile hit on splash (#3162)

* Revert projectile hit on splash

* Notes about potions splashing after hit cancelled
This commit is contained in:
Traks 2021-07-15 18:43:05 +02:00 committed by GitHub
parent fe65a0c548
commit 2e64ac6d25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}
}