Skip to content

Commit b73a0a7

Browse files
committed
Check mob-damage for potion splashes from e.g. witches.
Note that bypass bypasses this if the player with bypass is the target of the potion, but only for the player with bypass. Fixes #2134.
1 parent 2ea5068 commit b73a0a7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,6 @@ public void onPotionSplash(PotionSplashEvent event) {
10151015

10161016
// Fire item interaction event
10171017
Events.fireToCancel(event, new UseItemEvent(event, cause, world, potion.getItem()));
1018-
10191018
// Fire entity interaction event
10201019
if (!event.isCancelled()) {
10211020
int blocked = 0;
@@ -1027,8 +1026,11 @@ public void onPotionSplash(PotionSplashEvent event) {
10271026
? new DamageEntityEvent(event, cause, affected) :
10281027
new UseEntityEvent(event, cause, affected);
10291028

1030-
// Consider the potion splash flag
1029+
// Consider extra relevant flags
10311030
delegate.getRelevantFlags().add(Flags.POTION_SPLASH);
1031+
if (potion.getShooter() instanceof LivingEntity shooter && !(shooter instanceof Player) && affected instanceof Player) {
1032+
delegate.getRelevantFlags().add(Flags.MOB_DAMAGE);
1033+
}
10321034

10331035
if (Events.fireAndTestCancel(delegate)) {
10341036
event.setIntensity(affected, 0);

0 commit comments

Comments
 (0)