diff options
author | Cow <cow@volloeko.de> | 2023-07-25 23:11:11 +0200 |
---|---|---|
committer | Cow <cow@volloeko.de> | 2023-07-25 23:11:11 +0200 |
commit | 52aa971ea53d3540010d1aede2fe9885461ff8dd (patch) | |
tree | eb08e67333e4811769c18bbcd02e869c57274cca /src/main/java/de/cowtipper/cowlection/data/BestiaryEntry.java | |
parent | 579b5a9c0cecf6c4e21e42427164ec01dffc4b5b (diff) | |
download | Cowlection-52aa971ea53d3540010d1aede2fe9885461ff8dd.tar.gz Cowlection-52aa971ea53d3540010d1aede2fe9885461ff8dd.tar.bz2 Cowlection-52aa971ea53d3540010d1aede2fe9885461ff8dd.zip |
Fixed detection of bestiary overview GUI
Diffstat (limited to 'src/main/java/de/cowtipper/cowlection/data/BestiaryEntry.java')
-rw-r--r-- | src/main/java/de/cowtipper/cowlection/data/BestiaryEntry.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/main/java/de/cowtipper/cowlection/data/BestiaryEntry.java b/src/main/java/de/cowtipper/cowlection/data/BestiaryEntry.java index a6c78e7..956422c 100644 --- a/src/main/java/de/cowtipper/cowlection/data/BestiaryEntry.java +++ b/src/main/java/de/cowtipper/cowlection/data/BestiaryEntry.java @@ -40,6 +40,8 @@ public class BestiaryEntry { spacerChar = ' '; } + private boolean isMaxed; + public BestiaryEntry(String mobName, int currentKills, int killsGoal) { this.mobName = mobName; this.killsToGo = killsGoal - currentKills; @@ -61,14 +63,15 @@ public class BestiaryEntry { } /** - * Bestiary not unlocked yet + * Bestiary is maxed (when isMaxed=true), or has not been unlocked yet (when isMaxed=false) */ - public BestiaryEntry(String mobName) { + public BestiaryEntry(String mobName, boolean isMaxed) { this.mobName = mobName; mobNameWidth = -1; - killsToGo = Integer.MAX_VALUE; + killsToGo = Integer.MAX_VALUE - (isMaxed ? 0 : 1); killsGoal = -1; - percentageToGo = Integer.MAX_VALUE; + percentageToGo = Integer.MAX_VALUE - (isMaxed ? 0 : 1); + this.isMaxed = isMaxed; } public static void reinitialize(ItemStack triggerItem) { @@ -96,7 +99,10 @@ public class BestiaryEntry { } public String getFormattedOutput(boolean sortBestiaryOverviewByKills) { - if (percentageToGo == Integer.MAX_VALUE) { + if (isMaxed) { + return mobName + EnumChatFormatting.WHITE + ": maxed!"; + } + if (percentageToGo == Integer.MAX_VALUE - 1) { return mobName + EnumChatFormatting.GRAY + ": not unlocked yet"; } |