SPIGOT-5903: EntityDismountEvent cannot be triggered asynchronously

This commit is contained in:
md_5 2020-06-30 10:55:06 +10:00
parent 92cbf65649
commit 23aac2a53f
No known key found for this signature in database
GPG key ID: E8E901AC7C617C11

View file

@ -447,7 +447,7 @@
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.getRidingPassenger() instanceof EntityHuman)) { if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.getRidingPassenger() instanceof EntityHuman)) {
this.passengers.add(0, entity); this.passengers.add(0, entity);
} else { } else {
@@ -1604,15 +1872,33 @@ @@ -1604,15 +1872,36 @@
} }
} }
@ -467,7 +467,10 @@
+ (Vehicle) getBukkitEntity(), + (Vehicle) getBukkitEntity(),
+ (LivingEntity) entity.getBukkitEntity() + (LivingEntity) entity.getBukkitEntity()
+ ); + );
+ Bukkit.getPluginManager().callEvent(event); + // Suppress during worldgen
+ if (this.valid) {
+ Bukkit.getPluginManager().callEvent(event);
+ }
+ CraftEntity craftn = (CraftEntity) entity.getBukkitEntity().getVehicle(); + CraftEntity craftn = (CraftEntity) entity.getBukkitEntity().getVehicle();
+ Entity n = craftn == null ? null : craftn.getHandle(); + Entity n = craftn == null ? null : craftn.getHandle();
+ if (event.isCancelled() || n != orig) { + if (event.isCancelled() || n != orig) {
@ -482,7 +485,7 @@
} }
protected boolean q(Entity entity) { protected boolean q(Entity entity) {
@@ -1661,11 +1947,17 @@ @@ -1661,11 +1950,17 @@
ResourceKey<World> resourcekey = this.world.getDimensionKey() == World.THE_NETHER ? World.OVERWORLD : World.THE_NETHER; ResourceKey<World> resourcekey = this.world.getDimensionKey() == World.THE_NETHER ? World.OVERWORLD : World.THE_NETHER;
WorldServer worldserver1 = minecraftserver.getWorldServer(resourcekey); WorldServer worldserver1 = minecraftserver.getWorldServer(resourcekey);
@ -502,7 +505,7 @@
this.world.getMethodProfiler().exit(); this.world.getMethodProfiler().exit();
} }
@@ -1765,6 +2057,13 @@ @@ -1765,6 +2060,13 @@
} }
public void setSwimming(boolean flag) { public void setSwimming(boolean flag) {
@ -516,7 +519,7 @@
this.setFlag(4, flag); this.setFlag(4, flag);
} }
@@ -1825,16 +2124,56 @@ @@ -1825,16 +2127,56 @@
} }
public void setAirTicks(int i) { public void setAirTicks(int i) {
@ -576,7 +579,7 @@
} }
public void k(boolean flag) { public void k(boolean flag) {
@@ -1986,18 +2325,45 @@ @@ -1986,18 +2328,45 @@
@Nullable @Nullable
public Entity a(WorldServer worldserver) { public Entity a(WorldServer worldserver) {
@ -628,7 +631,7 @@
} else { } else {
double d0 = this.locX(); double d0 = this.locX();
double d1 = this.locZ(); double d1 = this.locZ();
@@ -2023,7 +2389,16 @@ @@ -2023,7 +2392,16 @@
Vec3D vec3d1 = this.getPortalOffset(); Vec3D vec3d1 = this.getPortalOffset();
blockposition = new BlockPosition(d0, this.locY(), d1); blockposition = new BlockPosition(d0, this.locY(), d1);
@ -646,7 +649,7 @@
if (shapedetector_shape == null) { if (shapedetector_shape == null) {
return null; return null;
@@ -2033,6 +2408,11 @@ @@ -2033,6 +2411,11 @@
vec3d = shapedetector_shape.velocity; vec3d = shapedetector_shape.velocity;
f = (float) shapedetector_shape.yaw; f = (float) shapedetector_shape.yaw;
} }
@ -658,7 +661,7 @@
this.world.getMethodProfiler().exitEnter("reloading"); this.world.getMethodProfiler().exitEnter("reloading");
Entity entity = this.getEntityType().a((World) worldserver); Entity entity = this.getEntityType().a((World) worldserver);
@@ -2042,9 +2422,17 @@ @@ -2042,9 +2425,17 @@
entity.setPositionRotation(blockposition, entity.yaw + f, entity.pitch); entity.setPositionRotation(blockposition, entity.yaw + f, entity.pitch);
entity.setMot(vec3d); entity.setMot(vec3d);
worldserver.addEntityTeleport(entity); worldserver.addEntityTeleport(entity);
@ -678,7 +681,7 @@
} }
this.bJ(); this.bJ();
@@ -2253,7 +2641,26 @@ @@ -2253,7 +2644,26 @@
} }
public void a(AxisAlignedBB axisalignedbb) { public void a(AxisAlignedBB axisalignedbb) {