Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +01:00
EntityExplodeEvent commit for craftbukkit.
Dieser Commit ist enthalten in:
Ursprung
ca9d523646
Commit
14d412e82c
@ -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.*;
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren