diff --git a/src/main/java/bentobox/addon/challenges/ChallengesManager.java b/src/main/java/bentobox/addon/challenges/ChallengesManager.java index 0d7a022..68b1bbc 100644 --- a/src/main/java/bentobox/addon/challenges/ChallengesManager.java +++ b/src/main/java/bentobox/addon/challenges/ChallengesManager.java @@ -225,7 +225,7 @@ public class ChallengesManager { int total = challengeMap.values().size(); int waiverAmount = en.getKey().getWaiveramount(); int challengesDone = (int) en.getValue().stream().filter(ch -> pd.isChallengeDone(world, ch.getUniqueId())).count(); - int challsToDo = Math.max(0,total-challengesDone-waiverAmount); + int challsToDo = Math.max(0,total - challengesDone - waiverAmount); boolean complete = challsToDo > 0 ? false : true; // Create result class with the data result.add(new LevelStatus(en.getKey(), previousLevel, challsToDo, complete, isUnlocked)); diff --git a/src/main/java/bentobox/addon/challenges/panel/ChallengesPanels2.java b/src/main/java/bentobox/addon/challenges/panel/ChallengesPanels2.java index f6b19c1..6c16743 100644 --- a/src/main/java/bentobox/addon/challenges/panel/ChallengesPanels2.java +++ b/src/main/java/bentobox/addon/challenges/panel/ChallengesPanels2.java @@ -3,7 +3,6 @@ package bentobox.addon.challenges.panel; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import java.util.Set; import org.bukkit.Material; import org.bukkit.World; @@ -47,6 +46,7 @@ public class ChallengesPanels2 { return; } if (level.isEmpty()) { + // TODO: open the furthest challenge panel level = manager.getChallengeList().keySet().iterator().next().getUniqueId(); } this.level = level; @@ -67,9 +67,8 @@ public class ChallengesPanels2 { } private void addChallengeItems(PanelBuilder panelBuilder) { - Set levelChallenges = manager.getChallenges(level, world); // Only show a control panel for the level requested. - for (Challenges challenge : levelChallenges) { + for (Challenges challenge : manager.getChallenges(level, world)) { createItem(panelBuilder, challenge); } } @@ -127,7 +126,7 @@ public class ChallengesPanels2 { private void addNavigation(PanelBuilder panelBuilder) { // Add navigation to other levels for (LevelStatus status: manager.getChallengeLevelStatus(user, world)) { - if (status.getLevel().getUniqueId().equals(level)) { + if (status.getLevel().getUniqueId().equalsIgnoreCase(level)) { // Skip if this is the current level continue; }