Block lightning from starting fires in claims

Should close #532
This commit is contained in:
RoboMWM 2019-06-14 00:49:26 -07:00
parent a0440733ed
commit c4a0012959
2 changed files with 5 additions and 3 deletions

View File

@ -632,9 +632,9 @@ public class BlockEventHandler implements Listener
if(!GriefPrevention.instance.claimsEnabledForWorld(igniteEvent.getBlock().getWorld())) return;
if(igniteEvent.getCause() == IgniteCause.LIGHTNING && GriefPrevention.instance.dataStore.getClaimAt(igniteEvent.getIgnitingEntity().getLocation(), false, null) != null){
if(igniteEvent.getIgnitingEntity().hasMetadata("GP_TRIDENT")){
// if(igniteEvent.getIgnitingEntity().hasMetadata("GP_TRIDENT")){ //BlockIgniteEvent is called before LightningStrikeEvent. See #532
igniteEvent.setCancelled(true);
}
// }
}
if(!GriefPrevention.instance.config_fireSpreads && igniteEvent.getCause() != IgniteCause.FLINT_AND_STEEL && igniteEvent.getCause() != IgniteCause.LIGHTNING)

View File

@ -719,8 +719,10 @@ public class EntityEventHandler implements Listener
EntityDamageByEntityEvent subEvent = (EntityDamageByEntityEvent) event;
if(subEvent.getDamager() instanceof LightningStrike && subEvent.getDamager().getMetadata("GP_TRIDENT").size() >= 1){
if(subEvent.getDamager() instanceof LightningStrike && subEvent.getDamager().hasMetadata("GP_TRIDENT"))
{
event.setCancelled(true);
return;
}
//determine which player is attacking, if any
Player attacker = null;