summaryrefslogtreecommitdiffstats
path: root/EssentialsProtect
diff options
context:
space:
mode:
authorGunfighterJ <joseph.jenniges@gmail.com>2013-03-15 14:41:42 -0500
committerGunfighterJ <joseph.jenniges@gmail.com>2013-03-15 14:54:51 -0500
commit96c5bebdf2e3a8e6b2d2ff3c3a9ab5bb9b5ed289 (patch)
treeaddcd952c3be032fa48be957ea42a5088803c0e2 /EssentialsProtect
parentfc96d7e0e9921d2694839a57240b2d7a8a0370cf (diff)
downloadEssentials-96c5bebdf2e3a8e6b2d2ff3c3a9ab5bb9b5ed289.tar
Essentials-96c5bebdf2e3a8e6b2d2ff3c3a9ab5bb9b5ed289.tar.gz
Essentials-96c5bebdf2e3a8e6b2d2ff3c3a9ab5bb9b5ed289.tar.lz
Essentials-96c5bebdf2e3a8e6b2d2ff3c3a9ab5bb9b5ed289.tar.xz
Essentials-96c5bebdf2e3a8e6b2d2ff3c3a9ab5bb9b5ed289.zip
Initial 1.5 update
Diffstat (limited to 'EssentialsProtect')
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java36
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java2
2 files changed, 27 insertions, 11 deletions
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
index bcfa52104..b2b2baa1d 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
@@ -102,7 +102,14 @@ public class EssentialsProtectEntityListener implements Listener
event.setCancelled(true);
return;
}
-
+
+ if (eAttack instanceof MinecartTNT && prot.getSettingBool(ProtectConfig.prevent_tntminecart_playerdmg)
+ && !(target instanceof Player && shouldBeDamaged(user, "tnt-minecart")))
+ {
+ event.setCancelled(true);
+ return;
+ }
+
// PVP Settings
if (target instanceof Player && eAttack instanceof Player
&& prot.getSettingBool(ProtectConfig.disable_pvp)
@@ -185,9 +192,10 @@ public class EssentialsProtectEntityListener implements Listener
{
return;
}
+ Entity entity = event.getEntity();
final int maxHeight = ess.getSettings().getProtectCreeperMaxHeight();
- if (event.getEntity() instanceof EnderDragon
+ if (entity instanceof EnderDragon
&& prot.getSettingBool(ProtectConfig.prevent_enderdragon_blockdmg))
{
event.setCancelled(true);
@@ -197,12 +205,12 @@ public class EssentialsProtectEntityListener implements Listener
}
return;
}
- if (event.getEntity() instanceof Wither
+ if (entity instanceof Wither
&& prot.getSettingBool(ProtectConfig.prevent_wither_spawnexplosion))
{
event.setCancelled(true);
}
- else if (event.getEntity() instanceof Creeper
+ else if (entity instanceof Creeper
&& (prot.getSettingBool(ProtectConfig.prevent_creeper_explosion)
|| prot.getSettingBool(ProtectConfig.prevent_creeper_blockdmg)
|| (maxHeight >= 0 && event.getLocation().getBlockY() > maxHeight)))
@@ -211,23 +219,27 @@ public class EssentialsProtectEntityListener implements Listener
event.setCancelled(true);
event.getLocation().getWorld().createExplosion(event.getLocation(), 0F);
}
- else if (event.getEntity() instanceof TNTPrimed
+ else if (entity instanceof TNTPrimed
&& prot.getSettingBool(ProtectConfig.prevent_tnt_explosion))
{
event.setCancelled(true);
}
- else if ((event.getEntity() instanceof Fireball || event.getEntity() instanceof SmallFireball)
+ else if ((entity instanceof Fireball || entity instanceof SmallFireball)
&& prot.getSettingBool(ProtectConfig.prevent_fireball_explosion))
{
event.setCancelled(true);
}
- else if ((event.getEntity() instanceof WitherSkull)
+ else if ((entity instanceof WitherSkull)
&& prot.getSettingBool(ProtectConfig.prevent_witherskull_explosion))
{
event.setCancelled(true);
-
+ }
+ else if ((entity instanceof MinecartTNT)
+ && prot.getSettingBool(ProtectConfig.prevent_tntminecart_explosion))
+ {
+ event.setCancelled(true);
}
}
@@ -304,9 +316,11 @@ public class EssentialsProtectEntityListener implements Listener
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPaintingBreak(HangingBreakByEntityEvent event)
{
- if (event.getCause() == HangingBreakEvent.RemoveCause.ENTITY
- && event.getRemover() instanceof Creeper
- && prot.getSettingBool(ProtectConfig.prevent_creeper_explosion))
+ if ((event.getCause() == HangingBreakEvent.RemoveCause.ENTITY)
+ && ((event.getRemover() instanceof Creeper) && prot.getSettingBool(ProtectConfig.prevent_creeper_explosion)
+ || (((event.getRemover() instanceof Fireball) || (event.getRemover() instanceof SmallFireball)) && prot.getSettingBool(ProtectConfig.prevent_fireball_explosion))
+ || ((event.getRemover() instanceof TNTPrimed) && prot.getSettingBool(ProtectConfig.prevent_tnt_explosion))
+ || ((event.getRemover() instanceof WitherSkull) && prot.getSettingBool(ProtectConfig.prevent_witherskull_explosion))))
{
event.setCancelled(true);
}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java
index 232322893..2faef22ed 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java
@@ -27,6 +27,8 @@ public enum ProtectConfig
prevent_block_on_rail("protect.protect.prevent-block-on-rails", false),
prevent_tnt_explosion("protect.prevent.tnt-explosion", false),
prevent_tnt_playerdmg("protect.prevent.tnt-playerdamage", false),
+ prevent_tntminecart_explosion("protect.prevent.tnt-minecart-explosion", false),
+ prevent_tntminecart_playerdmg("protect.prevent.tnt-minecart-playerdamage", false),
prevent_fireball_explosion("protect.prevent.fireball-explosion", false),
prevent_fireball_fire("protect.prevent.fireball-fire", false),
prevent_fireball_playerdmg("protect.prevent.fireball-playerdamage", false),