mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-12-11 19:36:46 +01:00
Protect hanging entities (paintings and item frames) from explosions; thanks to Tahkeh for the method
This commit is contained in:
parent
e83ac76b2c
commit
a783dc33cf
@ -31,6 +31,7 @@ import org.bukkit.event.entity.EntityTargetEvent;
|
|||||||
import org.bukkit.event.entity.PotionSplashEvent;
|
import org.bukkit.event.entity.PotionSplashEvent;
|
||||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||||
import org.bukkit.event.hanging.HangingBreakEvent;
|
import org.bukkit.event.hanging.HangingBreakEvent;
|
||||||
|
import org.bukkit.event.hanging.HangingBreakEvent.RemoveCause;
|
||||||
import org.bukkit.event.hanging.HangingPlaceEvent;
|
import org.bukkit.event.hanging.HangingPlaceEvent;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
@ -368,6 +369,16 @@ public class FactionsEntityListener implements Listener
|
|||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
|
|
||||||
|
if (event.getCause() == RemoveCause.EXPLOSION)
|
||||||
|
{
|
||||||
|
Faction faction = Board.getFactionAt(new FLocation(event.getEntity().getLocation()));
|
||||||
|
if (faction.getFlag(FFlag.EXPLOSIONS) == false)
|
||||||
|
{ // faction has explosions disabled
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! (event instanceof HangingBreakByEntityEvent))
|
if (! (event instanceof HangingBreakByEntityEvent))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user