Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<Boolean> 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<Boolean> 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());
Expand Down Expand Up @@ -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();
Expand All @@ -329,13 +330,15 @@ private void teleportOther(final IUser teleporter, final IUser teleportee, final
}

if (cooldown(true, future)) {
future.complete(false);
return;
}
if (delay <= 0 || teleporter == null
|| teleporter.isAuthorized("essentials.teleport.timer.bypass")
|| teleportOwner.isAuthorized("essentials.teleport.timer.bypass")
|| teleportee.isAuthorized("essentials.teleport.timer.bypass")) {
if (cooldown(false, future)) {
future.complete(false);
return;
}

Expand Down Expand Up @@ -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
Expand Down
Loading