Handle asynchronous player teleportation in PlayerTeleporterService with error handling and logging.

This commit is contained in:
akastijn 2026-07-11 17:14:32 +02:00
parent 0d757aa2ab
commit 3906bd747b

View File

@ -31,8 +31,12 @@ public class PlayerTeleporterService implements RoundListener {
} }
public void teleportPlayer(Player player, DESTINATION destination) { public void teleportPlayer(Player player, DESTINATION destination) {
log.info("Teleporting {} to {}}", player.getName(), destination.name()); Location locationFromDestination = getLocationFromDestination(destination);
player.teleport(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() { public void reset() {