mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 11:06:29 +01:00
EntityExplodeEvent commit for craftbukkit.
This commit is contained in:
parent
ca9d523646
commit
14d412e82c
@ -8,6 +8,9 @@ import org.bukkit.craftbukkit.CraftServer;
|
|||||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
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
|
// CraftBukkit end
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -117,7 +120,7 @@ public class Explosion {
|
|||||||
CraftEntity damagee = null;
|
CraftEntity damagee = null;
|
||||||
if (entity instanceof EntityPlayerMP) {
|
if (entity instanceof EntityPlayerMP) {
|
||||||
damagee = new CraftPlayer(servr, (EntityPlayerMP) entity);
|
damagee = new CraftPlayer(servr, (EntityPlayerMP) entity);
|
||||||
} else if(entity instanceof EntityLiving) {
|
} else if (entity instanceof EntityLiving) {
|
||||||
damagee = new CraftLivingEntity(servr, (EntityLiving) entity);
|
damagee = new CraftLivingEntity(servr, (EntityLiving) entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,7 +128,9 @@ public class Explosion {
|
|||||||
// Craftbukkit TODO: get the x/y/z of the tnt block?
|
// Craftbukkit TODO: get the x/y/z of the tnt block?
|
||||||
EntityDamageByBlockEvent edbbe = new EntityDamageByBlockEvent(null, damagee, EntityDamageEvent.DamageCause.BLOCK_EXPLOSION, damage);
|
EntityDamageByBlockEvent edbbe = new EntityDamageByBlockEvent(null, damagee, EntityDamageEvent.DamageCause.BLOCK_EXPLOSION, damage);
|
||||||
servr.getPluginManager().callEvent(edbbe);
|
servr.getPluginManager().callEvent(edbbe);
|
||||||
if(!edbbe.isCancelled()) entity.a(e, edbbe.getDamage());
|
if (!edbbe.isCancelled()) {
|
||||||
|
entity.a(e, edbbe.getDamage());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
CraftEntity damager = null;
|
CraftEntity damager = null;
|
||||||
if (e instanceof EntityPlayerMP) {
|
if (e instanceof EntityPlayerMP) {
|
||||||
@ -176,6 +181,29 @@ public class Explosion {
|
|||||||
ArrayList arraylist = new ArrayList();
|
ArrayList arraylist = new ArrayList();
|
||||||
|
|
||||||
((List) (arraylist)).addAll(((java.util.Collection) (g)));
|
((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--) {
|
for (int j = ((List) (arraylist)).size() - 1; j >= 0; j--) {
|
||||||
ChunkPosition chunkposition = (ChunkPosition) ((List) (arraylist)).get(j);
|
ChunkPosition chunkposition = (ChunkPosition) ((List) (arraylist)).get(j);
|
||||||
int k = chunkposition.a;
|
int k = chunkposition.a;
|
||||||
@ -211,5 +239,8 @@ public class Explosion {
|
|||||||
Block.m[j1].a_(i, k, l, i1);
|
Block.m[j1].a_(i, k, l, i1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Notch end
|
||||||
|
}
|
||||||
|
//Craftbukkit end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user