Made TNT blocking more aggressive. Also fixed explosion event.

This commit is contained in:
sk89q 2011-06-29 16:59:31 -07:00
parent bed6782a00
commit 162d53b66e

View File

@ -76,7 +76,7 @@ public void registerEvents() {
registerEvent("ENTITY_DAMAGE", Priority.High); registerEvent("ENTITY_DAMAGE", Priority.High);
registerEvent("ENTITY_COMBUST", Priority.High); registerEvent("ENTITY_COMBUST", Priority.High);
registerEvent("ENTITY_EXPLODE", Priority.High); registerEvent("ENTITY_EXPLODE", Priority.High);
registerEvent("ENTITY_PRIME", Priority.High); registerEvent("EXPLOSION_PRIME", Priority.High);
registerEvent("CREATURE_SPAWN", Priority.High); registerEvent("CREATURE_SPAWN", Priority.High);
registerEvent("ENTITY_INTERACT", Priority.High); registerEvent("ENTITY_INTERACT", Priority.High);
registerEvent("CREEPER_POWER", Priority.High); registerEvent("CREEPER_POWER", Priority.High);
@ -464,6 +464,12 @@ public void onEntityExplode(EntityExplodeEvent event) {
WorldConfiguration wcfg = cfg.get(world); WorldConfiguration wcfg = cfg.get(world);
Entity ent = event.getEntity(); Entity ent = event.getEntity();
if (cfg.activityHaltToggle) {
ent.remove();
event.setCancelled(true);
return;
}
if (ent instanceof LivingEntity) { if (ent instanceof LivingEntity) {
if (wcfg.blockCreeperBlockDamage) { if (wcfg.blockCreeperBlockDamage) {
event.setCancelled(true); event.setCancelled(true);
@ -485,12 +491,6 @@ public void onEntityExplode(EntityExplodeEvent event) {
} }
} }
} else if (ent instanceof TNTPrimed) { } else if (ent instanceof TNTPrimed) {
if (cfg.activityHaltToggle) {
ent.remove();
event.setCancelled(true);
return;
}
if (wcfg.blockTNT) { if (wcfg.blockTNT) {
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -540,12 +540,21 @@ public void onExplosionPrime(ExplosionPrimeEvent event) {
return; return;
} }
logger.info("PRIME");
ConfigurationManager cfg = plugin.getGlobalStateManager(); ConfigurationManager cfg = plugin.getGlobalStateManager();
Location l = event.getEntity().getLocation(); Location l = event.getEntity().getLocation();
World world = l.getWorld(); World world = l.getWorld();
WorldConfiguration wcfg = cfg.get(world); WorldConfiguration wcfg = cfg.get(world);
Entity ent = event.getEntity(); Entity ent = event.getEntity();
if (cfg.activityHaltToggle) {
logger.info("WG Halt-Act: Blocking " + ent.getClass().getName());
ent.remove();
event.setCancelled(true);
return;
}
if (ent instanceof Fireball) { if (ent instanceof Fireball) {
if (wcfg.blockFireballBlockDamage) { if (wcfg.blockFireballBlockDamage) {
event.setCancelled(true); event.setCancelled(true);