Added ghast fireball handling (instead of grouping with tnt) and fixed god mode player ignition.

This commit is contained in:
Wizjany 2011-05-20 20:32:50 -04:00
parent 98426f6dcc
commit 424b580eb9
2 changed files with 19 additions and 4 deletions

View File

@ -108,6 +108,7 @@ public void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
if (wcfg.disableLavaDamage && type == DamageCause.LAVA) { if (wcfg.disableLavaDamage && type == DamageCause.LAVA) {
event.setCancelled(true); event.setCancelled(true);
if (cfg.hasGodMode(player)) player.setFireTicks(0);
return; return;
} }
@ -268,6 +269,7 @@ public void onEntityDamage(EntityDamageEvent event) {
if (cfg.hasGodMode(player)) { if (cfg.hasGodMode(player)) {
event.setCancelled(true); event.setCancelled(true);
player.setFireTicks(0);
return; return;
} }
@ -326,8 +328,9 @@ public void onEntityExplode(EntityExplodeEvent event) {
Location l = event.getLocation(); Location l = event.getLocation();
World world = l.getWorld(); World world = l.getWorld();
WorldConfiguration wcfg = cfg.get(world); WorldConfiguration wcfg = cfg.get(world);
Entity ent = event.getEntity();
if (event.getEntity() instanceof LivingEntity) { if (ent instanceof LivingEntity) {
if (wcfg.blockCreeperBlockDamage) { if (wcfg.blockCreeperBlockDamage) {
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -347,7 +350,17 @@ public void onEntityExplode(EntityExplodeEvent event) {
return; return;
} }
} }
} else { // Shall assume that this is TNT } else if (ent instanceof Fireball) {
if (wcfg.useRegions) {
Vector pt = toVector(l);
RegionManager mgr = plugin.getGlobalRegionManager().get(world);
if (!mgr.getApplicableRegions(pt).allows(DefaultFlag.GHAST_FIREBALL)) {
event.setCancelled(true);
return;
}
}
} else if (ent instanceof TNTPrimed) {
if (wcfg.blockTNT) { if (wcfg.blockTNT) {
event.setCancelled(true); event.setCancelled(true);
return; return;

View File

@ -29,8 +29,9 @@ public final class DefaultFlag {
public static final StateFlag BUILD = new StateFlag("build", 'b', true); public static final StateFlag BUILD = new StateFlag("build", 'b', true);
public static final StateFlag PVP = new StateFlag("pvp", 'p', true); public static final StateFlag PVP = new StateFlag("pvp", 'p', true);
public static final StateFlag MOB_DAMAGE = new StateFlag("mob-damage", 'm', true); public static final StateFlag MOB_DAMAGE = new StateFlag("mob-damage", 'm', true);
public static final StateFlag MOB_SPAWNING = new StateFlag("mob-spawning", 'M', true); public static final StateFlag MOB_SPAWNING = new StateFlag("mob-spawning", true);
public static final StateFlag CREEPER_EXPLOSION = new StateFlag("creeper-explosion", 'c', true); public static final StateFlag CREEPER_EXPLOSION = new StateFlag("creeper-explosion", 'c', true);
public static final StateFlag GHAST_FIREBALL = new StateFlag("ghast-fireball", true);
public static final StateFlag SLEEP = new StateFlag("sleep", true); public static final StateFlag SLEEP = new StateFlag("sleep", true);
public static final StateFlag TNT = new StateFlag("tnt", 't', true); public static final StateFlag TNT = new StateFlag("tnt", 't', true);
public static final StateFlag LIGHTER = new StateFlag("lighter", 'l', true); public static final StateFlag LIGHTER = new StateFlag("lighter", 'l', true);
@ -62,7 +63,8 @@ public final class DefaultFlag {
TNT, LIGHTER, FIRE_SPREAD, LAVA_FIRE, CHEST_ACCESS, WATER_FLOW, LAVA_FLOW, TNT, LIGHTER, FIRE_SPREAD, LAVA_FIRE, CHEST_ACCESS, WATER_FLOW, LAVA_FLOW,
USE, PLACE_VEHICLE, GREET_MESSAGE, FAREWELL_MESSAGE, NOTIFY_GREET, USE, PLACE_VEHICLE, GREET_MESSAGE, FAREWELL_MESSAGE, NOTIFY_GREET,
NOTIFY_FAREWELL, DENY_SPAWN, HEAL_DELAY, HEAL_AMOUNT, TELE_LOC, NOTIFY_FAREWELL, DENY_SPAWN, HEAL_DELAY, HEAL_AMOUNT, TELE_LOC,
TELE_PERM, SPAWN_LOC, SPAWN_PERM, BUYABLE, PRICE, SNOW_FALL TELE_PERM, SPAWN_LOC, SPAWN_PERM, BUYABLE, PRICE, SNOW_FALL,
GHAST_FIREBALL
}; };
private DefaultFlag() { private DefaultFlag() {