From 1c487a6a609a0aba44f23cd109cd60d24e004961 Mon Sep 17 00:00:00 2001 From: speedxx <43330808+speedxx@users.noreply.github.com> Date: Thu, 27 Aug 2020 14:55:39 -0400 Subject: [PATCH] fix spectral arrows bypassing pvp blocking --- .../totalfreedommod/blocking/PVPBlocker.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/PVPBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/PVPBlocker.java index de388454..dc6cbcea 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/PVPBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/PVPBlocker.java @@ -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); } } - } - -} +} \ No newline at end of file