Update TeleportUtils
This commit is contained in:
parent
82fade61d5
commit
1c090a5a65
@ -28,6 +28,7 @@ public class TeleportUtils {
|
||||
try {//Detect Paper class
|
||||
Class<?> paperClass = Class.forName("com.destroystokyo.paper.PaperConfig");
|
||||
teleportAsyncMethod = Player.class.getMethod("teleportAsync", Location.class);
|
||||
teleportAsyncMethod.setAccessible(true);
|
||||
// if detected,use teleportAsync()
|
||||
} catch (ClassNotFoundException | NoSuchMethodException e) {
|
||||
teleportAsyncMethod = null;
|
||||
@ -38,7 +39,6 @@ public class TeleportUtils {
|
||||
public static void teleport(Player player, Location location) {
|
||||
if (teleportAsyncMethod != null) {
|
||||
try {
|
||||
teleportAsyncMethod.setAccessible(true);
|
||||
teleportAsyncMethod.invoke(player, location);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
player.teleport(location);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user