13
0
geforkt von Mirrors/Paper

Only call EntityPortalExitEvent if entity is actually in a portal

Dieser Commit ist enthalten in:
Jake Potrebic 2024-09-22 14:35:04 -07:00
Ursprung 802cb228d7
Commit f137f3cf13

Datei anzeigen

@ -23,6 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
to = teleEvent.getTo(); to = teleEvent.getTo();
- teleportTarget = new DimensionTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), teleportTarget.speed(), to.getYaw(), to.getPitch(), teleportTarget.missingRespawnBlock(), teleportTarget.postDimensionTransition(), teleportTarget.cause()); - teleportTarget = new DimensionTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), teleportTarget.speed(), to.getYaw(), to.getPitch(), teleportTarget.missingRespawnBlock(), teleportTarget.postDimensionTransition(), teleportTarget.cause());
+ // Paper start - Call EntityPortalExitEvent + // Paper start - Call EntityPortalExitEvent
+ if (this.portalProcess != null) { // if in a portal
+ CraftEntity bukkitEntity = this.getBukkitEntity(); + CraftEntity bukkitEntity = this.getBukkitEntity();
+ Vec3 velocity = teleportTarget.speed(); + Vec3 velocity = teleportTarget.speed();
+ org.bukkit.event.entity.EntityPortalExitEvent event = new org.bukkit.event.entity.EntityPortalExitEvent( + org.bukkit.event.entity.EntityPortalExitEvent event = new org.bukkit.event.entity.EntityPortalExitEvent(
@ -31,15 +32,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ bukkitEntity.getVelocity(), org.bukkit.craftbukkit.util.CraftVector.toBukkit(velocity) + bukkitEntity.getVelocity(), org.bukkit.craftbukkit.util.CraftVector.toBukkit(velocity)
+ ); + );
+ event.callEvent(); + event.callEvent();
+ if (this.isRemoved()) {
+ return null;
+ }
+ +
+ if (!event.isCancelled() && event.getTo() != null) { + if (!event.isCancelled() && event.getTo() != null) {
+ to = event.getTo().clone(); + to = event.getTo().clone();
+ velocity = org.bukkit.craftbukkit.util.CraftVector.toNMS(event.getAfter()); + velocity = org.bukkit.craftbukkit.util.CraftVector.toNMS(event.getAfter());
+ } + }
+ teleportTarget = new DimensionTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), velocity, to.getYaw(), to.getPitch(), teleportTarget.missingRespawnBlock(), teleportTarget.postDimensionTransition(), teleportTarget.cause()); + teleportTarget = new DimensionTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), velocity, to.getYaw(), to.getPitch(), teleportTarget.missingRespawnBlock(), teleportTarget.postDimensionTransition(), teleportTarget.cause());
+ }
+ if (this.isRemoved()) {
+ return null;
+ }
+ // Paper end - Call EntityPortalExitEvent + // Paper end - Call EntityPortalExitEvent
// CraftBukkit end // CraftBukkit end
ServerLevel worldserver1 = teleportTarget.newLevel(); ServerLevel worldserver1 = teleportTarget.newLevel();