Skip to content

Commit

Permalink
CAD please learn OOP
Browse files Browse the repository at this point in the history
  • Loading branch information
The Judge committed Sep 24, 2024
1 parent cc83f67 commit 99b2e4b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/pojlib/API.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public static void login(Activity activity)
}

MinecraftAccount acc = MinecraftAccount.load(activity.getFilesDir() + "/accounts");
if(acc != null && (acc.expiresOn >= System.currentTimeMillis() || !hasWifi || !Msa.doesOwnGame)) {
if(acc != null && (acc.expiresOn >= System.currentTimeMillis() || !hasWifi || acc.isDemoMode)) {
currentAcc = acc;
API.profileImage = MinecraftAccount.getSkinFaceUrl(API.currentAcc);
API.profileName = API.currentAcc.username;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/pojlib/account/MinecraftAccount.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class MinecraftAccount {
public String accessToken;
public String uuid;
public String username;
public boolean isDemoMode = false;
public long expiresOn;
public final String userType = "msa";

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/pojlib/account/Msa.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@ public MinecraftAccount performLogin(String msToken) throws MSAException {
acc.username = mcName;
acc.uuid = mcUuid;
acc.expiresOn = mcExpiresOn;
acc.isDemoMode = false;
} else {
acc.accessToken = "0";
acc.username = "Player";
acc.uuid = "00000000-0000-0000-0000-000000000000";
acc.expiresOn = 0;
acc.isDemoMode = true;
}

return acc;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/pojlib/util/json/MinecraftInstances.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public List<String> generateLaunchArgs(MinecraftAccount account) {
List<String> allArgs = new ArrayList<>(Arrays.asList("-cp", classpath));
allArgs.add(mainClass);
allArgs.addAll(Arrays.asList(mcArgs));
if (!Msa.doesOwnGame) {allArgs.add("--demo");}
if (account.isDemoMode) {
allArgs.add("--demo");
}

return allArgs;
}
Expand Down

0 comments on commit 99b2e4b

Please sign in to comment.