mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 23:10:16 +01:00
SPIGOT-5136: EntityPortalEvent getting called on interdimensional entity teleports
This commit is contained in:
parent
604c8bf07e
commit
fca41573a3
1 changed files with 21 additions and 18 deletions
|
@ -573,9 +573,8 @@
|
||||||
+ this.setOnFire(entityCombustEvent.getDuration(), false);
|
+ this.setOnFire(entityCombustEvent.getDuration(), false);
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
}
|
+ }
|
||||||
|
+
|
||||||
- this.damageEntity(DamageSource.LIGHTNING, 5.0F);
|
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ if (thisBukkitEntity instanceof Hanging) {
|
+ if (thisBukkitEntity instanceof Hanging) {
|
||||||
+ HangingBreakByEntityEvent hangingEvent = new HangingBreakByEntityEvent((Hanging) thisBukkitEntity, stormBukkitEntity);
|
+ HangingBreakByEntityEvent hangingEvent = new HangingBreakByEntityEvent((Hanging) thisBukkitEntity, stormBukkitEntity);
|
||||||
|
@ -584,8 +583,9 @@
|
||||||
+ if (hangingEvent.isCancelled()) {
|
+ if (hangingEvent.isCancelled()) {
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
|
- this.damageEntity(DamageSource.LIGHTNING, 5.0F);
|
||||||
+ if (this.isFireProof()) {
|
+ if (this.isFireProof()) {
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
|
@ -652,33 +652,36 @@
|
||||||
d0 *= 8.0D;
|
d0 *= 8.0D;
|
||||||
d1 *= 8.0D;
|
d1 *= 8.0D;
|
||||||
}
|
}
|
||||||
@@ -2088,6 +2442,25 @@
|
@@ -2088,6 +2442,28 @@
|
||||||
vec3d = shapedetector_shape.velocity;
|
vec3d = shapedetector_shape.velocity;
|
||||||
f = (float) shapedetector_shape.yaw;
|
f = (float) shapedetector_shape.yaw;
|
||||||
}
|
}
|
||||||
+ } // CraftBukkit
|
+ } // CraftBukkit
|
||||||
+
|
+
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ Location enter = this.getBukkitEntity().getLocation();
|
+ // SPIGOT-5136 - don't fire event for CraftEntity.teleport
|
||||||
+ Location exit = new Location(worldserver1.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
+ if (location == null) {
|
||||||
|
+ Location enter = this.getBukkitEntity().getLocation();
|
||||||
|
+ Location exit = new Location(worldserver1.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||||
+
|
+
|
||||||
+ EntityPortalEvent event = new EntityPortalEvent(this.getBukkitEntity(), enter, exit);
|
+ EntityPortalEvent event = new EntityPortalEvent(this.getBukkitEntity(), enter, exit);
|
||||||
+ event.getEntity().getServer().getPluginManager().callEvent(event);
|
+ event.getEntity().getServer().getPluginManager().callEvent(event);
|
||||||
+ if (event.isCancelled() || event.getTo() == null || event.getTo().getWorld() == null || !this.isAlive()) {
|
+ if (event.isCancelled() || event.getTo() == null || event.getTo().getWorld() == null || !this.isAlive()) {
|
||||||
+ return null;
|
+ return null;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ exit = event.getTo();
|
||||||
|
+ worldserver1 = ((CraftWorld) exit.getWorld()).getHandle();
|
||||||
|
+ blockposition = new BlockPosition(exit.getX(), exit.getY(), exit.getZ());
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ exit = event.getTo();
|
|
||||||
+ worldserver1 = ((CraftWorld) exit.getWorld()).getHandle();
|
|
||||||
+ blockposition = new BlockPosition(exit.getX(), exit.getY(), exit.getZ());
|
|
||||||
+
|
|
||||||
+ this.dimension = dimensionmanager;
|
+ this.dimension = dimensionmanager;
|
||||||
+ this.decouple();
|
+ this.decouple();
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
|
|
||||||
this.world.getMethodProfiler().exitEnter("reloading");
|
this.world.getMethodProfiler().exitEnter("reloading");
|
||||||
Entity entity = this.getEntityType().a((World) worldserver1);
|
Entity entity = this.getEntityType().a((World) worldserver1);
|
||||||
@@ -2097,6 +2470,14 @@
|
@@ -2097,6 +2473,14 @@
|
||||||
entity.setPositionRotation(blockposition, entity.yaw + f, entity.pitch);
|
entity.setPositionRotation(blockposition, entity.yaw + f, entity.pitch);
|
||||||
entity.setMot(vec3d);
|
entity.setMot(vec3d);
|
||||||
worldserver1.addEntityTeleport(entity);
|
worldserver1.addEntityTeleport(entity);
|
||||||
|
@ -693,7 +696,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dead = true;
|
this.dead = true;
|
||||||
@@ -2298,7 +2679,26 @@
|
@@ -2298,7 +2682,26 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(AxisAlignedBB axisalignedbb) {
|
public void a(AxisAlignedBB axisalignedbb) {
|
||||||
|
|
Loading…
Reference in a new issue