diff options
Diffstat (limited to 'EssentialsProtect')
3 files changed, 35 insertions, 0 deletions
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java index 53843843f..216a37564 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java @@ -53,6 +53,7 @@ public class EssentialsProtect extends JavaPlugin implements IConf, IProtect pm.registerEvent(Type.ENTITY_DAMAGE, entityListener, Priority.Highest, this); pm.registerEvent(Type.CREATURE_SPAWN, entityListener, Priority.Highest, this); pm.registerEvent(Type.ENTITY_TARGET, entityListener, Priority.Highest, this); + pm.registerEvent(Type.EXPLOSION_PRIME, entityListener, Priority.Highest, this); final EssentialsProtectWeatherListener weatherListener = new EssentialsProtectWeatherListener(this); pm.registerEvent(Type.LIGHTNING_STRIKE, weatherListener, Priority.Highest, this); diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java index ceb72bd8d..a71bcbd09 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java @@ -18,8 +18,10 @@ 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.Fireball;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
+import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityDamageByBlockEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
@@ -30,6 +32,7 @@ import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityListener;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
+import org.bukkit.event.entity.ExplosionPrimeEvent;
public class EssentialsProtectEntityListener extends EntityListener
@@ -118,6 +121,24 @@ public class EssentialsProtectEntityListener extends EntityListener event.setCancelled(true);
return;
}
+
+ if (eAttack instanceof Fireball && prot.getSettingBool(ProtectConfig.prevent_fireball_playerdmg)
+ && !(target instanceof Player
+ && user.isAuthorized("essentials.protect.damage.fireball")
+ && !user.isAuthorized("essentials.protect.damage.disable")))
+ {
+ event.setCancelled(true);
+ return;
+ }
+
+ if (eAttack instanceof TNTPrimed && prot.getSettingBool(ProtectConfig.prevent_tnt_playerdmg)
+ && !(target instanceof Player
+ && user.isAuthorized("essentials.protect.damage.tnt")
+ && !user.isAuthorized("essentials.protect.damage.disable")))
+ {
+ event.setCancelled(true);
+ return;
+ }
}
if (event instanceof EntityDamageByProjectileEvent
@@ -314,4 +335,14 @@ public class EssentialsProtectEntityListener extends EntityListener return;
}
}
+
+ @Override
+ public void onExplosionPrime(ExplosionPrimeEvent event)
+ {
+ if (event.getEntity() instanceof CraftFireball
+ && prot.getSettingBool(ProtectConfig.prevent_fireball_fire))
+ {
+ event.setFire(false);
+ }
+ }
}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java index 12b7c9fd9..9959db8c6 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java @@ -32,7 +32,10 @@ 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_tnt_playerdmg("protect.prevent.tnt-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), prevent_creeper_explosion("protect.prevent.creeper-explosion", true), prevent_creeper_playerdmg("protect.prevent.creeper-playerdamage", false), prevent_creeper_blockdmg("protect.prevent.creeper-blockdamage", false), |