mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-24 18:18:29 +01:00
Merge pull request #360 from GunfighterJ/patch-15
[Protect] Prevent creepers from breaking paintings if their explosions a...
This commit is contained in:
commit
bf8f0365d9
@ -13,6 +13,8 @@ import org.bukkit.event.Listener;
|
|||||||
import org.bukkit.event.entity.*;
|
import org.bukkit.event.entity.*;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||||
|
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||||
|
import org.bukkit.event.hanging.HangingBreakEvent;
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsProtectEntityListener implements Listener
|
public class EssentialsProtectEntityListener implements Listener
|
||||||
@ -332,4 +334,15 @@ public class EssentialsProtectEntityListener implements Listener
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onPaintingBreak(HangingBreakByEntityEvent event)
|
||||||
|
{
|
||||||
|
if (event.getCause() == HangingBreakEvent.RemoveCause.ENTITY
|
||||||
|
&& event.getRemover() instanceof Creeper
|
||||||
|
&& prot.getSettingBool(ProtectConfig.prevent_creeper_explosion))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user