Merge pull request #179 from Tahkeh/1.6.x-fix
Protecting Beacon and Anvil use by default and protecting Hanging entities from explosions
This commit is contained in:
commit
5ad6886d46
@ -309,6 +309,8 @@ public class Conf
|
|||||||
territoryProtectedMaterials.add(Material.ENCHANTMENT_TABLE);
|
territoryProtectedMaterials.add(Material.ENCHANTMENT_TABLE);
|
||||||
territoryProtectedMaterials.add(Material.CAULDRON);
|
territoryProtectedMaterials.add(Material.CAULDRON);
|
||||||
territoryProtectedMaterials.add(Material.SOIL);
|
territoryProtectedMaterials.add(Material.SOIL);
|
||||||
|
territoryProtectedMaterials.add(Material.BEACON);
|
||||||
|
territoryProtectedMaterials.add(Material.ANVIL);
|
||||||
|
|
||||||
territoryDenyUseageMaterials.add(Material.FIREBALL);
|
territoryDenyUseageMaterials.add(Material.FIREBALL);
|
||||||
territoryDenyUseageMaterials.add(Material.FLINT_AND_STEEL);
|
territoryDenyUseageMaterials.add(Material.FLINT_AND_STEEL);
|
||||||
@ -330,6 +332,8 @@ public class Conf
|
|||||||
territoryProtectedMaterialsWhenOffline.add(Material.ENCHANTMENT_TABLE);
|
territoryProtectedMaterialsWhenOffline.add(Material.ENCHANTMENT_TABLE);
|
||||||
territoryProtectedMaterialsWhenOffline.add(Material.CAULDRON);
|
territoryProtectedMaterialsWhenOffline.add(Material.CAULDRON);
|
||||||
territoryProtectedMaterialsWhenOffline.add(Material.SOIL);
|
territoryProtectedMaterialsWhenOffline.add(Material.SOIL);
|
||||||
|
territoryProtectedMaterialsWhenOffline.add(Material.BEACON);
|
||||||
|
territoryProtectedMaterialsWhenOffline.add(Material.ANVIL);
|
||||||
|
|
||||||
territoryDenyUseageMaterialsWhenOffline.add(Material.FIREBALL);
|
territoryDenyUseageMaterialsWhenOffline.add(Material.FIREBALL);
|
||||||
territoryDenyUseageMaterialsWhenOffline.add(Material.FLINT_AND_STEEL);
|
territoryDenyUseageMaterialsWhenOffline.add(Material.FLINT_AND_STEEL);
|
||||||
|
@ -34,6 +34,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;
|
||||||
@ -487,6 +488,62 @@ public class FactionsEntityListener implements Listener
|
|||||||
public void onPaintingBreak(HangingBreakEvent event)
|
public void onPaintingBreak(HangingBreakEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
|
if (event.getCause() == RemoveCause.EXPLOSION)
|
||||||
|
{
|
||||||
|
Location loc = event.getEntity().getLocation();
|
||||||
|
Faction faction = Board.getFactionAt(new FLocation(loc));
|
||||||
|
if (faction.noExplosionsInTerritory())
|
||||||
|
{
|
||||||
|
// faction is peaceful and has explosions set to disabled
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean online = faction.hasPlayersOnline();
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
(faction.isNone() && Conf.wildernessBlockCreepers && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName()))
|
||||||
|
||
|
||||||
|
(faction.isNormal() && (online ? Conf.territoryBlockCreepers : Conf.territoryBlockCreepersWhenOffline))
|
||||||
|
||
|
||||||
|
(faction.isWarZone() && Conf.warZoneBlockCreepers)
|
||||||
|
||
|
||||||
|
faction.isSafeZone()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// creeper which needs prevention
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
else if
|
||||||
|
(
|
||||||
|
(faction.isNone() && Conf.wildernessBlockFireballs && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName()))
|
||||||
|
||
|
||||||
|
(faction.isNormal() && (online ? Conf.territoryBlockFireballs : Conf.territoryBlockFireballsWhenOffline))
|
||||||
|
||
|
||||||
|
(faction.isWarZone() && Conf.warZoneBlockFireballs)
|
||||||
|
||
|
||||||
|
faction.isSafeZone()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// ghast fireball which needs prevention
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
else if
|
||||||
|
(
|
||||||
|
(faction.isNone() && Conf.wildernessBlockTNT && ! Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName()))
|
||||||
|
||
|
||||||
|
(faction.isNormal() && ( online ? Conf.territoryBlockTNT : Conf.territoryBlockTNTWhenOffline ))
|
||||||
|
||
|
||||||
|
(faction.isWarZone() && Conf.warZoneBlockTNT)
|
||||||
|
||
|
||||||
|
(faction.isSafeZone() && Conf.safeZoneBlockTNT)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// TNT which needs prevention
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! (event instanceof HangingBreakByEntityEvent))
|
if (! (event instanceof HangingBreakByEntityEvent))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user