From c2936186f8ca326659bf7a0b985603c5231a8dc7 Mon Sep 17 00:00:00 2001 From: snowleo Date: Wed, 6 Jul 2011 01:24:54 +0200 Subject: Now fireball explosion prevention has it's own config settings (was catched by tnt explosion prevention before) --- .../essentials/protect/EssentialsProtectEntityListener.java | 10 +++++++++- .../src/com/earth2me/essentials/protect/ProtectConfig.java | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'EssentialsProtect') diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java index f66302ffc..f8166b1d5 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java @@ -13,7 +13,9 @@ import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; +import org.bukkit.craftbukkit.entity.CraftFireball; import org.bukkit.craftbukkit.entity.CraftPlayer; +import org.bukkit.craftbukkit.entity.CraftTNTPrimed; import org.bukkit.entity.Creeper; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; @@ -221,12 +223,18 @@ public class EssentialsProtectEntityListener extends EntityListener event.setCancelled(true); return; } - else if (!(event.getEntity() instanceof LivingEntity) + else if (event.getEntity() instanceof CraftTNTPrimed && prot.getSettingBool(ProtectConfig.prevent_tnt_explosion)) { event.setCancelled(true); 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 // TODO: Use protect db instead of this code diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java index d9161bda8..75824c368 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java @@ -31,6 +31,7 @@ public enum ProtectConfig prevent_portal_creation("protect.prevent.portal-creation", false), prevent_block_on_rail("protect.protect.prevent-block-on-rails", 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_playerdmg("protect.prevent.creeper-playerdamage", false), prevent_creeper_blockdmg("protect.prevent.creeper-blockdamage", false), -- cgit v1.2.3