Fixed /god.

This commit is contained in:
sk89q 2011-04-02 15:54:41 -07:00
parent 3b9a426547
commit 1b843b3586

View File

@ -77,6 +77,11 @@ public void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
ConfigurationManager cfg = plugin.getGlobalConfiguration(); ConfigurationManager cfg = plugin.getGlobalConfiguration();
WorldConfiguration wcfg = cfg.get(player.getWorld()); WorldConfiguration wcfg = cfg.get(player.getWorld());
if (cfg.hasGodMode(player)) {
event.setCancelled(true);
return;
}
if (wcfg.disableLavaDamage && type == DamageCause.LAVA) { if (wcfg.disableLavaDamage && type == DamageCause.LAVA) {
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -100,6 +105,11 @@ public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
ConfigurationManager cfg = plugin.getGlobalConfiguration(); ConfigurationManager cfg = plugin.getGlobalConfiguration();
WorldConfiguration wcfg = cfg.get(player.getWorld()); WorldConfiguration wcfg = cfg.get(player.getWorld());
if (cfg.hasGodMode(player)) {
event.setCancelled(true);
return;
}
if (attacker != null && attacker instanceof Player) { if (attacker != null && attacker instanceof Player) {
if (wcfg.useRegions) { if (wcfg.useRegions) {
Vector pt = toVector(defender.getLocation()); Vector pt = toVector(defender.getLocation());
@ -151,6 +161,11 @@ public void onEntityDamageByProjectile(EntityDamageByProjectileEvent event) {
ConfigurationManager cfg = plugin.getGlobalConfiguration(); ConfigurationManager cfg = plugin.getGlobalConfiguration();
WorldConfiguration wcfg = cfg.get(player.getWorld()); WorldConfiguration wcfg = cfg.get(player.getWorld());
if (cfg.hasGodMode(player)) {
event.setCancelled(true);
return;
}
if (attacker != null && attacker instanceof Player) { if (attacker != null && attacker instanceof Player) {
if (wcfg.useRegions) { if (wcfg.useRegions) {
Vector pt = toVector(defender.getLocation()); Vector pt = toVector(defender.getLocation());
@ -205,6 +220,11 @@ public void onEntityDamage(EntityDamageEvent event) {
ConfigurationManager cfg = plugin.getGlobalConfiguration(); ConfigurationManager cfg = plugin.getGlobalConfiguration();
WorldConfiguration wcfg = cfg.get(player.getWorld()); WorldConfiguration wcfg = cfg.get(player.getWorld());
if (cfg.hasGodMode(player)) {
event.setCancelled(true);
return;
}
if (wcfg.disableFallDamage && type == DamageCause.FALL) { if (wcfg.disableFallDamage && type == DamageCause.FALL) {
event.setCancelled(true); event.setCancelled(true);
return; return;