From d968e3ab06cdff618e018b6de0d74a9024b15f09 Mon Sep 17 00:00:00 2001 From: 1wair <1wairesd.com.industries@gmail.com> Date: Fri, 27 Nov 2026 16:20:12 +0100 Subject: [PATCH] Fix TeleportWarmupEvent teleporter for teleportPlayer and warp AsyncTeleport#teleportPlayer and #warp(otherUser, ...) called teleport(otherUser, ...), which fires TeleportWarmupEvent with teleporter == teleportee, so listeners could not tell who ran /tphere, /tpahere, /tpaccept or /warp . Route them through teleportOther(teleportOwner, otherUser, ...) like back() already does, and complete the future with false when teleportOther stops early (event cancelled or cooldown), matching teleport(). Follow-up to #4673 / #4913. --- .../main/java/com/earth2me/essentials/AsyncTeleport.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/AsyncTeleport.java b/Essentials/src/main/java/com/earth2me/essentials/AsyncTeleport.java index b5e687f255..a7163aded9 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/AsyncTeleport.java +++ b/Essentials/src/main/java/com/earth2me/essentials/AsyncTeleport.java @@ -237,13 +237,13 @@ public void teleport(final Player entity, final Trade chargeFor, final TeleportC @Override public void teleportPlayer(final IUser otherUser, final Location loc, final Trade chargeFor, final TeleportCause cause, final CompletableFuture future) { - teleport(otherUser, new LocationTarget(loc), chargeFor, cause, future); + teleportOther(teleportOwner, otherUser, new LocationTarget(loc), chargeFor, cause, future); } @Override public void teleportPlayer(final IUser otherUser, final Player entity, final Trade chargeFor, final TeleportCause cause, final CompletableFuture future) { final ITarget target = new PlayerTarget(entity); - teleport(otherUser, target, chargeFor, cause, future); + teleportOther(teleportOwner, otherUser, target, chargeFor, cause, future); future.thenAccept(success -> { if (success) { otherUser.sendTl("teleporting", target.getLocation().getWorld().getName(), target.getLocation().getBlockX(), target.getLocation().getBlockY(), target.getLocation().getBlockZ()); @@ -309,6 +309,7 @@ private void teleportOther(final IUser teleporter, final IUser teleportee, final final TeleportWarmupEvent event = new TeleportWarmupEvent(teleporter, teleportee, cause, target, delay); Bukkit.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { + future.complete(false); return; } delay = event.getDelay(); @@ -329,6 +330,7 @@ private void teleportOther(final IUser teleporter, final IUser teleportee, final } if (cooldown(true, future)) { + future.complete(false); return; } if (delay <= 0 || teleporter == null @@ -336,6 +338,7 @@ private void teleportOther(final IUser teleporter, final IUser teleportee, final || teleportOwner.isAuthorized("essentials.teleport.timer.bypass") || teleportee.isAuthorized("essentials.teleport.timer.bypass")) { if (cooldown(false, future)) { + future.complete(false); return; } @@ -436,7 +439,7 @@ public void warp(final IUser otherUser, String warp, final Trade chargeFor, fina } } }); - teleport(otherUser, new LocationTarget(loc), chargeFor, cause, future); + teleportOther(teleportOwner, otherUser, new LocationTarget(loc), chargeFor, cause, future); } @Override