From 3906bd747b221e9c30ed3a4b5cb3d25d895b8004 Mon Sep 17 00:00:00 2001 From: akastijn Date: Sat, 11 Jul 2026 17:14:32 +0200 Subject: [PATCH] Handle asynchronous player teleportation in `PlayerTeleporterService` with error handling and logging. --- .../hunger_games/services/PlayerTeleporterService.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/alttd/hunger_games/services/PlayerTeleporterService.java b/src/main/java/com/alttd/hunger_games/services/PlayerTeleporterService.java index 1911a2b..238ec1f 100644 --- a/src/main/java/com/alttd/hunger_games/services/PlayerTeleporterService.java +++ b/src/main/java/com/alttd/hunger_games/services/PlayerTeleporterService.java @@ -31,8 +31,12 @@ public class PlayerTeleporterService implements RoundListener { } public void teleportPlayer(Player player, DESTINATION destination) { - log.info("Teleporting {} to {}}", player.getName(), destination.name()); - player.teleport(getLocationFromDestination(destination)); + Location locationFromDestination = getLocationFromDestination(destination); + try { + player.teleportAsync(getLocationFromDestination(destination)); + } catch (Exception e) { + log.error("Failed to teleport player {} to destination {} ({})", player.getName(), destination.name(), locationFromDestination, e); + } } public void reset() {