diff --git a/src/main/assets/lwjgl/version b/src/main/assets/lwjgl/version index e6dc9596..bfcf683d 100644 --- a/src/main/assets/lwjgl/version +++ b/src/main/assets/lwjgl/version @@ -1 +1 @@ -1730624021613 \ No newline at end of file +1730783037751 \ No newline at end of file diff --git a/src/main/java/pojlib/API.java b/src/main/java/pojlib/API.java index c9abd7cc..9a3c3e72 100644 --- a/src/main/java/pojlib/API.java +++ b/src/main/java/pojlib/API.java @@ -41,6 +41,7 @@ public class API { public static String memoryValue = "1800"; public static boolean developerMods; public static MinecraftAccount currentAcc; + public static boolean isDemoMode; public static MinecraftInstances.Instance currentInstance; public static boolean advancedDebugger; @@ -186,11 +187,11 @@ public static void launchInstance(Activity activity, MinecraftAccount account, M * Removes the user account * * @param activity The base directory where minecraft should be setup - * @param username The username of the profile to remove + * @param uuid The uuid of the profile to remove * @return True if removal was successful */ - public static boolean removeAccount(Activity activity, String username) { - return MinecraftAccount.removeAccount(activity, username); + public static boolean removeAccount(Activity activity, String uuid) { + return MinecraftAccount.removeAccount(activity, uuid); } /** @@ -198,7 +199,7 @@ public static boolean removeAccount(Activity activity, String username) { * * @param activity Android activity object */ - public static void login(Activity activity, @Nullable String accountName) + public static void login(Activity activity, @Nullable String accountUUID) { ConnectivityManager connManager = (ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkCapabilities capabilities = connManager.getNetworkCapabilities(connManager.getActiveNetwork()); @@ -209,7 +210,7 @@ public static void login(Activity activity, @Nullable String accountName) hasWifi = capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI); } - MinecraftAccount acc = MinecraftAccount.load(activity.getFilesDir() + "/accounts", accountName); + MinecraftAccount acc = MinecraftAccount.load(activity.getFilesDir() + "/accounts", accountUUID); if(acc != null && (acc.expiresOn >= System.currentTimeMillis() || !hasWifi || acc.isDemoMode)) { currentAcc = acc; API.profileImage = MinecraftAccount.getSkinFaceUrl(API.currentAcc); @@ -217,7 +218,7 @@ public static void login(Activity activity, @Nullable String accountName) API.profileUUID = API.currentAcc.uuid; return; } else if(acc != null && acc.expiresOn < System.currentTimeMillis()) { - currentAcc = LoginHelper.refreshAccount(activity, currentAcc.username); + currentAcc = LoginHelper.refreshAccount(activity, accountUUID); if(currentAcc == null) { LoginHelper.login(activity); } else { diff --git a/src/main/java/pojlib/account/Msa.java b/src/main/java/pojlib/account/Msa.java index 2b404cb1..ea244e2a 100644 --- a/src/main/java/pojlib/account/Msa.java +++ b/src/main/java/pojlib/account/Msa.java @@ -43,9 +43,9 @@ public class Msa { } /* Fields used to fill the account */ - public static String mcName; + public String mcName; public String mcToken; - public static String mcUuid; + public String mcUuid; public static boolean doesOwnGame; private Activity activity; private long mcExpiresOn; @@ -66,7 +66,7 @@ public MinecraftAccount performLogin(String msToken) throws MSAException { fetchOwnedItems(mcToken); checkMcProfile(mcToken); - MinecraftAccount acc = MinecraftAccount.load(activity.getFilesDir() + "/accounts", mcName); + MinecraftAccount acc = MinecraftAccount.load(activity.getFilesDir() + "/accounts", mcUuid); if (acc == null) acc = new MinecraftAccount(); if (doesOwnGame) { acc.accessToken = mcToken; @@ -74,12 +74,14 @@ public MinecraftAccount performLogin(String msToken) throws MSAException { acc.uuid = mcUuid; acc.expiresOn = mcExpiresOn; acc.isDemoMode = false; + API.isDemoMode = false; } else { acc.accessToken = "0"; acc.username = "Player"; acc.uuid = "00000000-0000-0000-0000-000000000000"; acc.expiresOn = 0; acc.isDemoMode = true; + API.isDemoMode = true; } return acc; @@ -204,7 +206,7 @@ private void fetchOwnedItems(String mcAccessToken) throws MSAException, IOExcept } // Returns false for failure // - public static boolean checkMcProfile(String mcAccessToken) throws IOException, MSAException, JSONException { + public boolean checkMcProfile(String mcAccessToken) throws IOException, MSAException, JSONException { URL url = new URL(Constants.MC_PROFILE_URL); HttpURLConnection conn = (HttpURLConnection)url.openConnection();