SPIGOT-3063: Call EntityAirChangeEvent

This commit is contained in:
md_5 2017-02-14 10:34:56 +11:00
parent a552117725
commit 2683195ecd

View File

@ -426,13 +426,14 @@
this.passengers.remove(entity); this.passengers.remove(entity);
entity.j = 60; entity.j = 60;
} }
@@ -1715,14 +1975,48 @@ @@ -1715,14 +1975,49 @@
} }
public void setAirTicks(int i) { public void setAirTicks(int i) {
- this.datawatcher.set(Entity.az, Integer.valueOf(i)); - this.datawatcher.set(Entity.az, Integer.valueOf(i));
+ // CraftBukkit start + // CraftBukkit start
+ EntityAirChangeEvent event = new EntityAirChangeEvent(this.getBukkitEntity(), i); + EntityAirChangeEvent event = new EntityAirChangeEvent(this.getBukkitEntity(), i);
+ event.getEntity().getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) { + if (event.isCancelled()) {
+ return; + return;
+ } + }
@ -478,7 +479,7 @@
} }
} }
@@ -1867,19 +2161,70 @@ @@ -1867,19 +2162,70 @@
if (!this.world.isClientSide && !this.dead) { if (!this.world.isClientSide && !this.dead) {
this.world.methodProfiler.a("changeDimension"); this.world.methodProfiler.a("changeDimension");
MinecraftServer minecraftserver = this.B_(); MinecraftServer minecraftserver = this.B_();
@ -552,7 +553,7 @@
BlockPosition blockposition; BlockPosition blockposition;
if (i == 1) { if (i == 1) {
@@ -1908,12 +2253,18 @@ @@ -1908,12 +2254,18 @@
blockposition = new BlockPosition(this); blockposition = new BlockPosition(this);
} }
@ -572,7 +573,7 @@
if (j == 1 && i == 1) { if (j == 1 && i == 1) {
BlockPosition blockposition1 = worldserver1.q(worldserver1.getSpawn()); BlockPosition blockposition1 = worldserver1.q(worldserver1.getSpawn());
@@ -1921,6 +2272,7 @@ @@ -1921,6 +2273,7 @@
} else { } else {
entity.setPositionRotation(blockposition, entity.yaw, entity.pitch); entity.setPositionRotation(blockposition, entity.yaw, entity.pitch);
} }
@ -580,7 +581,7 @@
boolean flag = entity.attachedToPlayer; boolean flag = entity.attachedToPlayer;
@@ -1928,13 +2280,21 @@ @@ -1928,13 +2281,21 @@
worldserver1.addEntity(entity); worldserver1.addEntity(entity);
entity.attachedToPlayer = flag; entity.attachedToPlayer = flag;
worldserver1.entityJoinedWorld(entity, false); worldserver1.entityJoinedWorld(entity, false);
@ -603,7 +604,7 @@
return entity; return entity;
} else { } else {
return null; return null;
@@ -2038,6 +2398,11 @@ @@ -2038,6 +2399,11 @@
} }
public void setCustomName(String s) { public void setCustomName(String s) {
@ -615,7 +616,7 @@
this.datawatcher.set(Entity.aA, s); this.datawatcher.set(Entity.aA, s);
} }
@@ -2095,7 +2460,26 @@ @@ -2095,7 +2461,26 @@
} }
public void a(AxisAlignedBB axisalignedbb) { public void a(AxisAlignedBB axisalignedbb) {
@ -643,7 +644,7 @@
} }
public float getHeadHeight() { public float getHeadHeight() {
@@ -2269,7 +2653,7 @@ @@ -2269,7 +2654,7 @@
for (Iterator iterator = this.bx().iterator(); iterator.hasNext(); entity.a(oclass, set)) { for (Iterator iterator = this.bx().iterator(); iterator.hasNext(); entity.a(oclass, set)) {
entity = (Entity) iterator.next(); entity = (Entity) iterator.next();
if (oclass.isAssignableFrom(entity.getClass())) { if (oclass.isAssignableFrom(entity.getClass())) {