mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-03-02 11:11:58 +01:00
Fix warp messages sending incorrectly with teleport delays (#3696)
Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
This commit is contained in:
parent
e2c6170eba
commit
d78832498e
@ -253,6 +253,7 @@ public class AsyncTeleport implements IAsyncTeleport {
|
|||||||
final TeleportWarmupEvent event = new TeleportWarmupEvent(teleportee, cause, target, delay);
|
final TeleportWarmupEvent event = new TeleportWarmupEvent(teleportee, cause, target, delay);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
|
future.complete(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
delay = event.getDelay();
|
delay = event.getDelay();
|
||||||
@ -273,10 +274,12 @@ public class AsyncTeleport implements IAsyncTeleport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cooldown(true, future)) {
|
if (cooldown(true, future)) {
|
||||||
|
future.complete(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (delay <= 0 || teleportOwner.isAuthorized("essentials.teleport.timer.bypass") || teleportee.isAuthorized("essentials.teleport.timer.bypass")) {
|
if (delay <= 0 || teleportOwner.isAuthorized("essentials.teleport.timer.bypass") || teleportee.isAuthorized("essentials.teleport.timer.bypass")) {
|
||||||
if (cooldown(false, future)) {
|
if (cooldown(false, future)) {
|
||||||
|
future.complete(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nowAsync(teleportee, target, cause, future);
|
nowAsync(teleportee, target, cause, future);
|
||||||
@ -286,6 +289,7 @@ public class AsyncTeleport implements IAsyncTeleport {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
future.complete(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,10 +417,15 @@ public class AsyncTeleport implements IAsyncTeleport {
|
|||||||
future.completeExceptionally(e);
|
future.completeExceptionally(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
otherUser.sendMessage(tl("warpingTo", warp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
final String finalWarp = warp;
|
||||||
|
future.thenAccept(success -> {
|
||||||
|
if (success) {
|
||||||
|
otherUser.sendMessage(tl("warpingTo", finalWarp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
||||||
if (!otherUser.equals(teleportOwner)) {
|
if (!otherUser.equals(teleportOwner)) {
|
||||||
teleportOwner.sendMessage(tl("warpingTo", warp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
teleportOwner.sendMessage(tl("warpingTo", finalWarp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
teleport(otherUser, new LocationTarget(loc), chargeFor, cause, future);
|
teleport(otherUser, new LocationTarget(loc), chargeFor, cause, future);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user