Fix for PVP flame damage.

https://github.com/BentoBoxWorld/bentobox/issues/336
This commit is contained in:
tastybento 2018-11-11 17:39:05 -08:00
parent 968ebbad67
commit d9528c6c9b

View File

@ -20,8 +20,8 @@ import org.bukkit.event.entity.LingeringPotionSplashEvent;
import org.bukkit.event.entity.PotionSplashEvent; import org.bukkit.event.entity.PotionSplashEvent;
import org.bukkit.event.player.PlayerFishEvent; import org.bukkit.event.player.PlayerFishEvent;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.api.flags.Flag; import world.bentobox.bentobox.api.flags.Flag;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.lists.Flags; import world.bentobox.bentobox.lists.Flags;
@ -79,14 +79,16 @@ public class PVPListener extends FlagListener {
} else if (damager instanceof Projectile) { } else if (damager instanceof Projectile) {
// Find out who fired the arrow // Find out who fired the arrow
Projectile p = (Projectile) damager; Projectile p = (Projectile) damager;
if (p.getShooter() instanceof Player) { Entity entity =(Entity)p.getShooter();
if (entity instanceof Player) {
// Allow self damage // Allow self damage
if (hurtEntity.equals(p.getShooter())) { if (hurtEntity.equals(entity)) {
return; return;
} }
User user = User.getInstance((Player)p.getShooter()); User user = User.getInstance((Player)p.getShooter());
if (!setUser(user).checkIsland((Event)e, damager.getLocation(), flag)) { if (!setUser(user).checkIsland((Event)e, damager.getLocation(), flag)) {
damager.setFireTicks(0); damager.setFireTicks(0);
hurtEntity.setFireTicks(0);
damager.remove(); damager.remove();
user.notify(Flags.PVP_OVERWORLD.getHintReference()); user.notify(Flags.PVP_OVERWORLD.getHintReference());
e.setCancelled(true); e.setCancelled(true);