Don't put entities removed during the portal exit event into an invalid state

This commit is contained in:
Nassim Jahnke 2023-08-08 17:48:55 +10:00
parent 75a9ce0e01
commit c0bced1fa1

View file

@ -21,7 +21,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ org.bukkit.event.entity.EntityPortalExitEvent event = new org.bukkit.event.entity.EntityPortalExitEvent(bukkitEntity,
+ bukkitEntity.getLocation(), new Location(worldserver.getWorld(), position.x, position.y, position.z, yaw, pitch),
+ bukkitEntity.getVelocity(), org.bukkit.craftbukkit.util.CraftVector.toBukkit(shapedetectorshape.speed));
+ if (event.callEvent() && event.getTo() != null && this.isAlive()) {
+ event.callEvent();
+ if (this.isRemoved()) {
+ return null;
+ }
+
+ if (!event.isCancelled() && event.getTo() != null) {
+ worldserver = ((CraftWorld) event.getTo().getWorld()).getHandle();
+ position = new Vec3(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
+ yaw = event.getTo().getYaw();