Now fireball explosion prevention has it's own config settings (was catched by tnt explosion prevention before)

This commit is contained in:
snowleo 2011-07-06 01:24:54 +02:00
parent 5006c68af2
commit c2936186f8
3 changed files with 11 additions and 1 deletions

View File

@ -325,6 +325,7 @@ protect:
lightning-fire-spread: true lightning-fire-spread: true
portal-creation: false portal-creation: false
tnt-explosion: false tnt-explosion: false
fireball-explosion: false
creeper-explosion: false creeper-explosion: false
creeper-playerdamage: false creeper-playerdamage: false
creeper-blockdamage: false creeper-blockdamage: false

View File

@ -13,7 +13,9 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.entity.CraftFireball;
import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.entity.CraftTNTPrimed;
import org.bukkit.entity.Creeper; import org.bukkit.entity.Creeper;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -221,12 +223,18 @@ public class EssentialsProtectEntityListener extends EntityListener
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
else if (!(event.getEntity() instanceof LivingEntity) else if (event.getEntity() instanceof CraftTNTPrimed
&& prot.getSettingBool(ProtectConfig.prevent_tnt_explosion)) && prot.getSettingBool(ProtectConfig.prevent_tnt_explosion))
{ {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
else if (event.getEntity() instanceof CraftFireball
&& prot.getSettingBool(ProtectConfig.prevent_fireball_explosion))
{
event.setCancelled(true);
return;
}
// This code will prevent explosions near protected rails, signs or protected chests // This code will prevent explosions near protected rails, signs or protected chests
// TODO: Use protect db instead of this code // TODO: Use protect db instead of this code

View File

@ -31,6 +31,7 @@ public enum ProtectConfig
prevent_portal_creation("protect.prevent.portal-creation", false), prevent_portal_creation("protect.prevent.portal-creation", false),
prevent_block_on_rail("protect.protect.prevent-block-on-rails", false), prevent_block_on_rail("protect.protect.prevent-block-on-rails", false),
prevent_tnt_explosion("protect.prevent.tnt-explosion", false), prevent_tnt_explosion("protect.prevent.tnt-explosion", false),
prevent_fireball_explosion("protect.prevent.fireball-explosion", false),
prevent_creeper_explosion("protect.prevent.creeper-explosion", true), prevent_creeper_explosion("protect.prevent.creeper-explosion", true),
prevent_creeper_playerdmg("protect.prevent.creeper-playerdamage", false), prevent_creeper_playerdmg("protect.prevent.creeper-playerdamage", false),
prevent_creeper_blockdmg("protect.prevent.creeper-blockdamage", false), prevent_creeper_blockdmg("protect.prevent.creeper-blockdamage", false),