mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-30 04:57:40 +01:00
Check shooter of projectile when one hits a hanging entity
This commit is contained in:
parent
d214a859c3
commit
f2d7135fc5
@ -30,6 +30,7 @@
|
|||||||
import org.bukkit.entity.ItemFrame;
|
import org.bukkit.entity.ItemFrame;
|
||||||
import org.bukkit.entity.Painting;
|
import org.bukkit.entity.Painting;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -79,6 +80,10 @@ public void onHangingingBreak(HangingBreakEvent event) {
|
|||||||
if (event instanceof HangingBreakByEntityEvent) {
|
if (event instanceof HangingBreakByEntityEvent) {
|
||||||
HangingBreakByEntityEvent entityEvent = (HangingBreakByEntityEvent) event;
|
HangingBreakByEntityEvent entityEvent = (HangingBreakByEntityEvent) event;
|
||||||
Entity removerEntity = entityEvent.getRemover();
|
Entity removerEntity = entityEvent.getRemover();
|
||||||
|
if (removerEntity instanceof Projectile) {
|
||||||
|
Projectile projectile = (Projectile) removerEntity;
|
||||||
|
removerEntity = projectile.getShooter() != null ? projectile.getShooter() : removerEntity;
|
||||||
|
}
|
||||||
|
|
||||||
if (removerEntity instanceof Player) {
|
if (removerEntity instanceof Player) {
|
||||||
Player player = (Player) removerEntity;
|
Player player = (Player) removerEntity;
|
||||||
|
Loading…
Reference in New Issue
Block a user