Merge pull request #279 from speedxx/development

fix spectral arrows bypassing pvp blocking
This commit is contained in:
Telesphoreo 2020-08-28 10:16:37 -05:00 committed by GitHub
commit 44fe8f6f94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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