From 9102eba6e32babb8d20cc92d4a6c9d1e0979c882 Mon Sep 17 00:00:00 2001 From: syeyoung Date: Mon, 27 Feb 2023 01:44:15 +0900 Subject: - Fix #344, profile viewer not showing latest profile Signed-off-by: syeyoung --- .../features/impl/party/playerpreview/api/ApiFetcher.java | 15 ++++----------- .../playerpreview/api/playerprofile/PlayerProfile.java | 2 +- .../api/playerprofile/PlayerProfileParser.java | 2 +- 3 files changed, 6 insertions(+), 13 deletions(-) (limited to 'mod/src/main/java/kr/syeyoung') diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/ApiFetcher.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/ApiFetcher.java index 1c234f59..cbc8be12 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/ApiFetcher.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/ApiFetcher.java @@ -323,23 +323,16 @@ public class ApiFetcher { System.out.println("finished getting secrets from achievement"); - System.out.println("Getting last save"); - JsonElement last_save = semiProfile.get("last_save"); - if(last_save != null){ - float lastSave2 = last_save.getAsLong(); - if (lastSave2 > lastSave) { - latest = e; - lastSave = lastSave2; - } + System.out.println("Getting selected profile"); + if (e.isSelected()) { + latest = e; } - System.out.println("Finished getting last save"); - playerProfiles.add(e); } System.out.println("THE AMOUNT OF PLAYER PROFILES: " + playerProfiles.size()); PlayerProfile[] p = new PlayerProfile[playerProfiles.size()]; - pp.setLatestProfileArrayIndex(getArrayIndex(p, latest)); pp.setPlayerProfiles(playerProfiles.toArray(p)); + pp.setLatestProfileArrayIndex(getArrayIndex(p, latest)); return Optional.of(pp); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/PlayerProfile.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/PlayerProfile.java index b8de1836..4ec35d04 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/PlayerProfile.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/PlayerProfile.java @@ -33,7 +33,7 @@ public class PlayerProfile { private String memberUID; private String profileName; - private long lastSave; + private boolean selected; private int fairySouls; private int fairyExchanges; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/PlayerProfileParser.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/PlayerProfileParser.java index 6f53994c..775fb474 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/PlayerProfileParser.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/PlayerProfileParser.java @@ -100,7 +100,7 @@ public class PlayerProfileParser { playerProfile.setProfileName(getOrDefault(profile, "cute_name", "")); JsonObject playerData = profile.getAsJsonObject("members").getAsJsonObject(dashTrimmed); - playerProfile.setLastSave(getOrDefault(playerData, "last_save", 0L)); + playerProfile.setSelected(profile.has("selected") && profile.get("selected").getAsBoolean()); playerProfile.setFairySouls(getOrDefault(playerData, "fairy_souls_collected", 0)); playerProfile.setFairyExchanges(getOrDefault(playerData, "fairy_exchanges", 0)); -- cgit