From c89a8186962ce7f775b2273c0099aad6a1685291 Mon Sep 17 00:00:00 2001 From: HaHaWTH Date: Sun, 31 Dec 2023 14:10:28 +0800 Subject: [PATCH] improve getMinHeight() --- .../xephi/authme/listener/LoginLocationFixListener.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/listener/LoginLocationFixListener.java b/src/main/java/fr/xephi/authme/listener/LoginLocationFixListener.java index 9774ec93..c48652ec 100644 --- a/src/main/java/fr/xephi/authme/listener/LoginLocationFixListener.java +++ b/src/main/java/fr/xephi/authme/listener/LoginLocationFixListener.java @@ -35,7 +35,7 @@ public class LoginLocationFixListener implements Listener { private static Material materialPortal = Material.matchMaterial("PORTAL"); - private static int isChecked = 0; // 0: unchecked 1: method available 2: method not available + private static boolean isChecked = false; // false: unchecked/method not available true: method is available private final boolean isSmartAsyncTeleport = AuthMe.settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT); private final boolean isFixPortalStuck = AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_PORTAL); private final boolean isFixGroundStuck = AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_UNDERGROUND); @@ -50,15 +50,15 @@ public class LoginLocationFixListener implements Listener { } try { Method getMinHeightMethod = World.class.getMethod("getMinHeight"); - isChecked = 1; + isChecked = true; } catch (NoSuchMethodException e) { - isChecked = 2; + isChecked = false; } } private int getMinHeight(World world) { //This keeps compatibility of 1.16.x and lower - if (isChecked == 1) { + if (isChecked) { return world.getMinHeight(); } else { return 0;