Limited fire protection to claims-enabled worlds.

This commit is contained in:
ryanhamshire 2014-12-09 15:11:32 -08:00
parent da24015259
commit acbfc5036e

View File

@ -527,6 +527,10 @@ public class BlockEventHandler implements Listener
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void onBlockIgnite (BlockIgniteEvent igniteEvent) public void onBlockIgnite (BlockIgniteEvent igniteEvent)
{ {
//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) if(!GriefPrevention.instance.config_fireSpreads && igniteEvent.getCause() != IgniteCause.FLINT_AND_STEEL && igniteEvent.getCause() != IgniteCause.LIGHTNING)
{ {
igniteEvent.setCancelled(true); igniteEvent.setCancelled(true);
@ -539,6 +543,9 @@ public class BlockEventHandler implements Listener
{ {
if(spreadEvent.getSource().getType() != Material.FIRE) return; 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) if(!GriefPrevention.instance.config_fireSpreads)
{ {
spreadEvent.setCancelled(true); spreadEvent.setCancelled(true);
@ -552,9 +559,6 @@ public class BlockEventHandler implements Listener
return; 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 //never spread into a claimed area, regardless of settings
if(this.dataStore.getClaimAt(spreadEvent.getBlock().getLocation(), false, null) != null) if(this.dataStore.getClaimAt(spreadEvent.getBlock().getLocation(), false, null) != null)
{ {
@ -573,6 +577,9 @@ public class BlockEventHandler implements Listener
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void onBlockBurn (BlockBurnEvent burnEvent) public void onBlockBurn (BlockBurnEvent burnEvent)
{ {
//don't track in worlds where claims are not enabled
if(!GriefPrevention.instance.claimsEnabledForWorld(burnEvent.getBlock().getWorld())) return;
if(!GriefPrevention.instance.config_fireDestroys) if(!GriefPrevention.instance.config_fireDestroys)
{ {
burnEvent.setCancelled(true); burnEvent.setCancelled(true);
@ -605,9 +612,6 @@ public class BlockEventHandler implements Listener
return; 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 //never burn claimed blocks, regardless of settings
if(this.dataStore.getClaimAt(burnEvent.getBlock().getLocation(), false, null) != null) if(this.dataStore.getClaimAt(burnEvent.getBlock().getLocation(), false, null) != null)
{ {