This commit is contained in:
HaHaWTH 2023-12-09 20:17:57 +08:00
parent 7fa7d17ba6
commit 16c0a8a81b

View File

@ -6,6 +6,8 @@ import org.bukkit.entity.Player;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import static org.bukkit.Bukkit.getLogger;
/** /**
* This class is a utility class for handling async teleportation of players in game. * This class is a utility class for handling async teleportation of players in game.
*/ */
@ -34,11 +36,14 @@ public class TeleportUtils {
if (teleportAsyncMethod != null) { if (teleportAsyncMethod != null) {
try { try {
teleportAsyncMethod.invoke(player, location); teleportAsyncMethod.invoke(player, location);
getLogger().info("Using async teleport method");
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
player.teleport(location); player.teleport(location);
getLogger().info("Using legacy teleport method");
} }
} else { } else {
player.teleport(location); player.teleport(location);
getLogger().info("Using legacy teleport method");
} }
} }
} }