mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-02-21 14:52:05 +01:00
Fixes potion splash pvp check (#1230)
Before this change, the entire potion splash would be cancelled if a single protected player would have been affected. Now, it will only remove the protected players themselves from the affected list.
This commit is contained in:
parent
c57b56f1f0
commit
706bed62ec
@ -136,8 +136,12 @@ public class PVPListener extends FlagListener {
|
||||
public void onSplashPotionSplash(final PotionSplashEvent e) {
|
||||
if (e.getEntity().getShooter() instanceof Player && getPlugin().getIWM().inWorld(e.getEntity().getWorld())) {
|
||||
User user = User.getInstance((Player)e.getEntity().getShooter());
|
||||
// Run through affected entities and cancel the splash if any are a protected player
|
||||
e.setCancelled(e.getAffectedEntities().stream().anyMatch(le -> blockPVP(user, le, e, getFlag(e.getEntity().getWorld()))));
|
||||
// Run through affected entities and cancel the splash for protected players
|
||||
for (LivingEntity le : e.getAffectedEntities()) {
|
||||
if (!le.getUniqueId().equals(user.getUniqueId()) && blockPVP(user, le, e, getFlag(e.getEntity().getWorld()))) {
|
||||
e.setIntensity(le, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user