mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-12-01 06:53:37 +01:00
Fix the issue with incorrect unlock status. (#169)
The issue was that it never decrease challengesToDo with completed challenges from previous level, so only first level was unlocked. My mistake.
This commit is contained in:
parent
0026cb7404
commit
707625a9da
@ -989,7 +989,8 @@ public class ChallengesManager
|
|||||||
ChallengeLevel previousLevel = levelIndex < 1 ? null : challengeLevelList.get(levelIndex - 1);
|
ChallengeLevel previousLevel = levelIndex < 1 ? null : challengeLevelList.get(levelIndex - 1);
|
||||||
|
|
||||||
int challengesToDo = previousLevel == null ? 0 :
|
int challengesToDo = previousLevel == null ? 0 :
|
||||||
(previousLevel.getChallenges().size() - level.getWaiverAmount());
|
(previousLevel.getChallenges().size() - level.getWaiverAmount()) -
|
||||||
|
(int) previousLevel.getChallenges().stream().filter(playerData::isChallengeDone).count();
|
||||||
|
|
||||||
// As level already contains unique ids of challenges, just iterate through them.
|
// As level already contains unique ids of challenges, just iterate through them.
|
||||||
int doneChallengeCount = (int) level.getChallenges().stream().filter(playerData::isChallengeDone).count();
|
int doneChallengeCount = (int) level.getChallenges().stream().filter(playerData::isChallengeDone).count();
|
||||||
|
Loading…
Reference in New Issue
Block a user