Dieser Commit ist enthalten in:
Tahg 2011-01-17 16:46:40 -05:00
Commit 1b7279b7c6

Datei anzeigen

@ -8,6 +8,9 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.entity.EntityDamageByBlockEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.CraftBlock;
// CraftBukkit end
import java.util.*;
@ -117,7 +120,7 @@ public class Explosion {
CraftEntity damagee = null;
if (entity instanceof EntityPlayerMP) {
damagee = new CraftPlayer(servr, (EntityPlayerMP) entity);
} else if(entity instanceof EntityLiving) {
} else if (entity instanceof EntityLiving) {
damagee = new CraftLivingEntity(servr, (EntityLiving) entity);
}
@ -125,7 +128,9 @@ public class Explosion {
// Craftbukkit TODO: get the x/y/z of the tnt block?
EntityDamageByBlockEvent edbbe = new EntityDamageByBlockEvent(null, damagee, EntityDamageEvent.DamageCause.BLOCK_EXPLOSION, damage);
servr.getPluginManager().callEvent(edbbe);
if(!edbbe.isCancelled()) entity.a(e, edbbe.getDamage());
if (!edbbe.isCancelled()) {
entity.a(e, edbbe.getDamage());
}
} else {
CraftEntity damager = null;
if (e instanceof EntityPlayerMP) {
@ -176,6 +181,29 @@ public class Explosion {
ArrayList arraylist = new ArrayList();
((List) (arraylist)).addAll(((java.util.Collection) (g)));
// Craftbukkit start
CraftServer servr = ((WorldServer) i).getServer();
CraftWorld wrld = ((WorldServer) i).getWorld();
org.bukkit.entity.Entity splode;
if (this.e instanceof EntityCreeper) {
splode = new CraftLivingEntity(servr, (EntityLiving) e);
} else {
splode = (org.bukkit.entity.Entity) this.e;
}
ArrayList blocklist = new ArrayList();
for (int j = ((List) (arraylist)).size() - 1; j >= 0; j--) {
ChunkPosition cpos = (ChunkPosition) ((List) (arraylist)).get(j);
org.bukkit.craftbukkit.block.CraftBlock blox = new org.bukkit.craftbukkit.block.CraftBlock(wrld, cpos.a, cpos.b, cpos.c, wrld.getBlockTypeIdAt(cpos.a, cpos.b, cpos.c), wrld.getBlockAt(cpos.a, cpos.b, cpos.c).getData());
if (!blox.getType().equals(org.bukkit.Material.AIR)) {
blocklist.add(blox);
}
}
EntityExplodeEvent eee = new EntityExplodeEvent(EntityExplodeEvent.Type.ENTITY_EXPLODE, splode, blocklist);
servr.getPluginManager().callEvent(eee);
if (!(eee.isCancelled())) {
// Notch start
for (int j = ((List) (arraylist)).size() - 1; j >= 0; j--) {
ChunkPosition chunkposition = (ChunkPosition) ((List) (arraylist)).get(j);
int k = chunkposition.a;
@ -211,5 +239,8 @@ public class Explosion {
Block.m[j1].a_(i, k, l, i1);
}
}
// Notch end
}
//Craftbukkit end
}
}