aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyeyoung <cyoung06@naver.com>2023-02-27 01:44:15 +0900
committersyeyoung <cyoung06@naver.com>2023-02-27 01:44:15 +0900
commit9102eba6e32babb8d20cc92d4a6c9d1e0979c882 (patch)
tree5137285e84069497966be7c94c6a8a8b77825c06
parent88b227041d9d2201cb0859142843ddb8cedbe8ce (diff)
downloadSkyblock-Dungeons-Guide-9102eba6e32babb8d20cc92d4a6c9d1e0979c882.tar.gz
Skyblock-Dungeons-Guide-9102eba6e32babb8d20cc92d4a6c9d1e0979c882.tar.bz2
Skyblock-Dungeons-Guide-9102eba6e32babb8d20cc92d4a6c9d1e0979c882.zip
- Fix #344, profile viewer not showing latest profile
Signed-off-by: syeyoung <cyoung06@naver.com>
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/ApiFetcher.java15
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/PlayerProfile.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/PlayerProfileParser.java2
3 files changed, 6 insertions, 13 deletions
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));