Handle asynchronous player teleportation in PlayerTeleporterService with error handling and logging.
This commit is contained in:
parent
0d757aa2ab
commit
3906bd747b
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user