Fix timedTeleport to run asynchronously using thenApplyAsync

This commit is contained in:
William278 committed 2022-09-03 15:17:50 +03:00
1 parent 973ae90905
commit 53b16ed75f
1 file changed
+1 -1
@@ -388,7 +388,7 @@ public class TeleportManager {
*/
private CompletableFuture<TimedTeleport> processTeleportWarmup(@NotNull final TimedTeleport teleport) {
// Execute the warmup start event
return plugin.getEventDispatcher().dispatchTeleportWarmupEvent(teleport, teleport.timeLeft).thenApply(event -> {
return plugin.getEventDispatcher().dispatchTeleportWarmupEvent(teleport, teleport.timeLeft).thenApplyAsync(event -> {
// Handle event cancellation
if (event.isCancelled()) {
teleport.cancelled = true;