From acbfc5036e5743f31091775796a8dfabb24253bd Mon Sep 17 00:00:00 2001 From: ryanhamshire Date: Tue, 9 Dec 2014 15:11:32 -0800 Subject: [PATCH] Limited fire protection to claims-enabled worlds. --- .../GriefPrevention/BlockEventHandler.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/me/ryanhamshire/GriefPrevention/BlockEventHandler.java b/src/me/ryanhamshire/GriefPrevention/BlockEventHandler.java index 29080d1..a82c614 100644 --- a/src/me/ryanhamshire/GriefPrevention/BlockEventHandler.java +++ b/src/me/ryanhamshire/GriefPrevention/BlockEventHandler.java @@ -527,7 +527,11 @@ public class BlockEventHandler implements Listener @EventHandler(priority = EventPriority.LOWEST) public void onBlockIgnite (BlockIgniteEvent igniteEvent) { - if(!GriefPrevention.instance.config_fireSpreads && igniteEvent.getCause() != IgniteCause.FLINT_AND_STEEL && igniteEvent.getCause() != IgniteCause.LIGHTNING) + //don't track in worlds where claims are not enabled + if(!GriefPrevention.instance.claimsEnabledForWorld(igniteEvent.getBlock().getWorld())) return; + + + if(!GriefPrevention.instance.config_fireSpreads && igniteEvent.getCause() != IgniteCause.FLINT_AND_STEEL && igniteEvent.getCause() != IgniteCause.LIGHTNING) { igniteEvent.setCancelled(true); } @@ -539,6 +543,9 @@ public class BlockEventHandler implements Listener { if(spreadEvent.getSource().getType() != Material.FIRE) return; + //don't track in worlds where claims are not enabled + if(!GriefPrevention.instance.claimsEnabledForWorld(spreadEvent.getBlock().getWorld())) return; + if(!GriefPrevention.instance.config_fireSpreads) { spreadEvent.setCancelled(true); @@ -552,9 +559,6 @@ public class BlockEventHandler implements Listener return; } - //don't track in worlds where claims are not enabled - if(!GriefPrevention.instance.claimsEnabledForWorld(spreadEvent.getBlock().getWorld())) return; - //never spread into a claimed area, regardless of settings if(this.dataStore.getClaimAt(spreadEvent.getBlock().getLocation(), false, null) != null) { @@ -573,7 +577,10 @@ public class BlockEventHandler implements Listener @EventHandler(priority = EventPriority.LOWEST) public void onBlockBurn (BlockBurnEvent burnEvent) { - if(!GriefPrevention.instance.config_fireDestroys) + //don't track in worlds where claims are not enabled + if(!GriefPrevention.instance.claimsEnabledForWorld(burnEvent.getBlock().getWorld())) return; + + if(!GriefPrevention.instance.config_fireDestroys) { burnEvent.setCancelled(true); Block block = burnEvent.getBlock(); @@ -605,9 +612,6 @@ public class BlockEventHandler implements Listener return; } - //don't track in worlds where claims are not enabled - if(!GriefPrevention.instance.claimsEnabledForWorld(burnEvent.getBlock().getWorld())) return; - //never burn claimed blocks, regardless of settings if(this.dataStore.getClaimAt(burnEvent.getBlock().getLocation(), false, null) != null) {