fix spectral arrows bypassing pvp blocking

This commit is contained in:
speedxx 2020-08-27 14:55:39 -04:00
parent f98f6990ea
commit 1c487a6a60

View File

@ -6,6 +6,7 @@ import org.bukkit.GameMode;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.FishHook;
import org.bukkit.entity.Player;
import org.bukkit.entity.SpectralArrow;
import org.bukkit.entity.Trident;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -43,6 +44,14 @@ public class PVPBlocker extends FreedomService
player = (Player)arrow.getShooter();
}
}
else if (event.getDamager() instanceof SpectralArrow)
{
SpectralArrow spectralArrow = (SpectralArrow)event.getDamager();
if (spectralArrow.getShooter() instanceof Player)
{
player = (Player)spectralArrow.getShooter();
}
}
else if (event.getDamager() instanceof Trident)
{
Trident trident = (Trident)event.getDamager();
@ -84,7 +93,5 @@ public class PVPBlocker extends FreedomService
event.setCancelled(true);
}
}
}
}
}