From 2bbb4e5c87c8bb9ceb0f7206cbdc3ae9913626c9 Mon Sep 17 00:00:00 2001 From: BONNe Date: Sun, 10 Feb 2019 17:00:30 +0200 Subject: [PATCH] Fix issue when Challenges were not sorted by order number. --- .../java/world/bentobox/challenges/ChallengesManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/world/bentobox/challenges/ChallengesManager.java b/src/main/java/world/bentobox/challenges/ChallengesManager.java index 94d4ac2..6cc219e 100644 --- a/src/main/java/world/bentobox/challenges/ChallengesManager.java +++ b/src/main/java/world/bentobox/challenges/ChallengesManager.java @@ -689,8 +689,8 @@ public class ChallengesManager String worldName = Util.getWorld(world).getName(); // TODO: Probably need to check also database. return this.challengeCacheData.values().stream(). - sorted(Comparator.comparing(Challenge::getOrder)). filter(challenge -> challenge.getUniqueId().startsWith(worldName)). + sorted(Comparator.comparing(Challenge::getOrder)). collect(Collectors.toList()); } @@ -705,6 +705,7 @@ public class ChallengesManager // Free Challenges hides under FREE level. return this.getAllChallenges(world).stream(). filter(challenge -> challenge.getLevel().equals(FREE)). + sorted(Comparator.comparing(Challenge::getOrder)). collect(Collectors.toList()); } @@ -719,6 +720,7 @@ public class ChallengesManager return level.getChallenges().stream(). map(this::getChallenge). filter(Objects::nonNull). + sorted(Comparator.comparing(Challenge::getOrder)). collect(Collectors.toList()); }