diff options
author | Cow <cow@volloeko.de> | 2022-10-03 13:24:07 +0200 |
---|---|---|
committer | Cow <cow@volloeko.de> | 2022-10-03 13:24:07 +0200 |
commit | 5ff6bdf6c27b7d27dbb501b52b5a8f7eb7f87cbd (patch) | |
tree | 49f4f4475f17c32ef3a40103133fb3e47b40e5b1 /src/main/java/de/cowtipper/cowlection/data/HySkyBlockStats.java | |
parent | 4566b79b70728c1f81b4bd619f399c2bce293e32 (diff) | |
download | Cowlection-5ff6bdf6c27b7d27dbb501b52b5a8f7eb7f87cbd.tar.gz Cowlection-5ff6bdf6c27b7d27dbb501b52b5a8f7eb7f87cbd.tar.bz2 Cowlection-5ff6bdf6c27b7d27dbb501b52b5a8f7eb7f87cbd.zip |
Fixed completely broken API based features
- username lookup by uuid
- determination of active/selected profile
- also replaced 'last save' with 'last profile save'
Diffstat (limited to 'src/main/java/de/cowtipper/cowlection/data/HySkyBlockStats.java')
-rw-r--r-- | src/main/java/de/cowtipper/cowlection/data/HySkyBlockStats.java | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/main/java/de/cowtipper/cowlection/data/HySkyBlockStats.java b/src/main/java/de/cowtipper/cowlection/data/HySkyBlockStats.java index 9b51f02..fb38fe7 100644 --- a/src/main/java/de/cowtipper/cowlection/data/HySkyBlockStats.java +++ b/src/main/java/de/cowtipper/cowlection/data/HySkyBlockStats.java @@ -49,19 +49,18 @@ public class HySkyBlockStats { if (profiles == null) { return null; } - Profile lastSavedProfile = null; - long latestSave = -1; for (Profile profile : profiles) { - long lastProfileSave = profile.getMember(uuid).last_save; - if (latestSave < lastProfileSave) { - lastSavedProfile = profile; - latestSave = lastProfileSave; + if (profile.selected) { + return profile; } } - return lastSavedProfile; + // no selected profile + return null; } public static class Profile { + public boolean selected; + private long last_save; private String cute_name; private Map<String, Member> members; private String game_mode; @@ -87,7 +86,10 @@ public class HySkyBlockStats { } else if ("ironman".equals(game_mode)) { return EnumChatFormatting.GRAY + "♲"; } - return ""; + } + + public Pair<String, String> getFancyLastSave() { + return (last_save > 0) ? Utils.getDurationAsWords(last_save) : null; } public double getCoinBank() { @@ -127,7 +129,6 @@ public class HySkyBlockStats { } public static class Member { - private long last_save; private long first_join; private double coin_purse; private NbtData inv_armor; @@ -158,10 +159,6 @@ public class HySkyBlockStats { return Utils.getDurationAsWords(first_join); } - public Pair<String, String> getFancyLastSave() { - return Utils.getDurationAsWords(last_save); - } - public double getCoinPurse() { return coin_purse; } @@ -477,7 +474,7 @@ public class HySkyBlockStats { */ public String getSummary(boolean isMasterFloor) { String floorCompletion; - if (tier_completions != null) { + if (tier_completions != null && tier_completions.size() > 0) { int highestTierCompletions = tier_completions.get(String.valueOf(highest_tier_completed)); floorCompletion = "" + highestTierCompletions + EnumChatFormatting.GRAY + "x " + EnumChatFormatting.YELLOW + "Floor " + (MooConfig.useRomanNumerals() ? Utils.convertArabicToRoman(highest_tier_completed) : highest_tier_completed); } else { |