Skip to content

Commit

Permalink
Fix potions thrown by a dispenser not applying effects when pve flag …
Browse files Browse the repository at this point in the history
…is 'false'
  • Loading branch information
MrSteppy authored and yannicklamprecht committed May 12, 2024
1 parent 446a429 commit d5dbcce
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.projectiles.BlockProjectileSource;
import org.bukkit.projectiles.ProjectileSource;
Expand Down Expand Up @@ -335,9 +336,17 @@ public static boolean entityDamage(Entity damager, Entity victim, EntityDamageEv
}
}
return true;
} else if (dplot != null && (!dplot.equals(vplot) || Objects
.equals(dplot.getOwnerAbs(), vplot.getOwnerAbs()))) {
return vplot != null && vplot.getFlag(PveFlag.class);
} else {
if (damager instanceof ThrownPotion thrownPotion && thrownPotion.getShooter() instanceof BlockProjectileSource && Objects.equals(
dplot,
vplot
)) {
return true;
}

if (dplot != null && (!dplot.equals(vplot) || Objects.equals(dplot.getOwnerAbs(), vplot.getOwnerAbs()))) {
return vplot != null && vplot.getFlag(PveFlag.class);
}
}
//disable the firework damage. too much of a headache to support at the moment.
if (vplot != null) {
Expand Down

0 comments on commit d5dbcce

Please sign in to comment.