mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-12-01 06:53:37 +01:00
Fix logical error that opens all levels instead of locking them.
WaiverAmount should be reducer, not from whom reduces.
This commit is contained in:
parent
38fce9a4b0
commit
53da2d67c7
@ -488,10 +488,10 @@ public class ChallengesManager
|
|||||||
{
|
{
|
||||||
// To find how many challenges user still must do in previous level, we must
|
// To find how many challenges user still must do in previous level, we must
|
||||||
// know how many challenges there were and how many has been done. Then
|
// know how many challenges there were and how many has been done. Then
|
||||||
// from waiver amount remove calculated value and you get count.
|
// remove waiver amount to get count of challenges that still necessary to do.
|
||||||
|
|
||||||
int challengesToDo = previousLevel == null ? 0 :
|
int challengesToDo = previousLevel == null ? 0 :
|
||||||
level.getWaiverAmount() - (previousLevel.getChallenges().size() - doneChallengeCount);
|
(previousLevel.getChallenges().size() - doneChallengeCount - level.getWaiverAmount());
|
||||||
|
|
||||||
// As level already contains unique ids of challenges, just iterate through them.
|
// As level already contains unique ids of challenges, just iterate through them.
|
||||||
doneChallengeCount = (int) level.getChallenges().stream().filter(playerData::isChallengeDone).count();
|
doneChallengeCount = (int) level.getChallenges().stream().filter(playerData::isChallengeDone).count();
|
||||||
|
Loading…
Reference in New Issue
Block a user