From 1b843b35864658ab81898acbe362f6c01c707aa1 Mon Sep 17 00:00:00 2001 From: sk89q Date: Sat, 2 Apr 2011 15:54:41 -0700 Subject: [PATCH] Fixed /god. --- .../bukkit/WorldGuardEntityListener.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/com/sk89q/worldguard/bukkit/WorldGuardEntityListener.java b/src/com/sk89q/worldguard/bukkit/WorldGuardEntityListener.java index b98fa994..279f91c6 100644 --- a/src/com/sk89q/worldguard/bukkit/WorldGuardEntityListener.java +++ b/src/com/sk89q/worldguard/bukkit/WorldGuardEntityListener.java @@ -76,6 +76,11 @@ public void onEntityDamageByBlock(EntityDamageByBlockEvent event) { ConfigurationManager cfg = plugin.getGlobalConfiguration(); WorldConfiguration wcfg = cfg.get(player.getWorld()); + + if (cfg.hasGodMode(player)) { + event.setCancelled(true); + return; + } if (wcfg.disableLavaDamage && type == DamageCause.LAVA) { event.setCancelled(true); @@ -99,6 +104,11 @@ public void onEntityDamageByEntity(EntityDamageByEntityEvent event) { ConfigurationManager cfg = plugin.getGlobalConfiguration(); WorldConfiguration wcfg = cfg.get(player.getWorld()); + + if (cfg.hasGodMode(player)) { + event.setCancelled(true); + return; + } if (attacker != null && attacker instanceof Player) { if (wcfg.useRegions) { @@ -150,6 +160,11 @@ public void onEntityDamageByProjectile(EntityDamageByProjectileEvent event) { ConfigurationManager cfg = plugin.getGlobalConfiguration(); WorldConfiguration wcfg = cfg.get(player.getWorld()); + + if (cfg.hasGodMode(player)) { + event.setCancelled(true); + return; + } if (attacker != null && attacker instanceof Player) { if (wcfg.useRegions) { @@ -204,6 +219,11 @@ public void onEntityDamage(EntityDamageEvent event) { ConfigurationManager cfg = plugin.getGlobalConfiguration(); WorldConfiguration wcfg = cfg.get(player.getWorld()); + + if (cfg.hasGodMode(player)) { + event.setCancelled(true); + return; + } if (wcfg.disableFallDamage && type == DamageCause.FALL) { event.setCancelled(true);