mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-18 06:57:49 +01:00
Make Explosion remember whether it was canceled so that WorldServer can avoid sending unneeded explode packets.
This commit is contained in:
parent
499d44763d
commit
f20af7b129
@ -29,6 +29,7 @@ public class Explosion {
|
|||||||
public Entity e;
|
public Entity e;
|
||||||
public float f;
|
public float f;
|
||||||
public Set g = new HashSet();
|
public Set g = new HashSet();
|
||||||
|
public boolean wasCanceled = false;
|
||||||
|
|
||||||
public Explosion(World world, Entity entity, double d0, double d1, double d2, float f) {
|
public Explosion(World world, Entity entity, double d0, double d1, double d2, float f) {
|
||||||
this.i = world;
|
this.i = world;
|
||||||
@ -199,6 +200,7 @@ public class Explosion {
|
|||||||
server.getPluginManager().callEvent(event);
|
server.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
|
wasCanceled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -113,6 +113,12 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
|||||||
public Explosion a(Entity entity, double d0, double d1, double d2, float f, boolean flag) {
|
public Explosion a(Entity entity, double d0, double d1, double d2, float f, boolean flag) {
|
||||||
Explosion explosion = super.a(entity, d0, d1, d2, f, flag);
|
Explosion explosion = super.a(entity, d0, d1, d2, f, flag);
|
||||||
|
|
||||||
|
// Craftbukkit start
|
||||||
|
if(explosion.wasCanceled) {
|
||||||
|
return explosion;
|
||||||
|
}
|
||||||
|
// Craftbukkit end
|
||||||
|
|
||||||
this.D.f.a(d0, d1, d2, 64.0D, new Packet60Explosion(d0, d1, d2, f, explosion.g));
|
this.D.f.a(d0, d1, d2, 64.0D, new Packet60Explosion(d0, d1, d2, f, explosion.g));
|
||||||
return explosion;
|
return explosion;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user