mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-12-29 04:18:05 +01:00
Implement remove one time challenge option in ChallengesGUI.
This commit is contained in:
parent
810d57e042
commit
31b2fed8bc
@ -4,7 +4,6 @@ package world.bentobox.challenges.panel.user;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import world.bentobox.bentobox.api.panels.PanelItem;
|
||||
@ -145,6 +144,13 @@ public class ChallengesGUI extends CommonGUI
|
||||
private void addFreeChallenges(PanelBuilder panelBuilder, int firstItemIndex)
|
||||
{
|
||||
List<Challenge> freeChallenges = this.challengesManager.getFreeChallenges(this.world);
|
||||
|
||||
if (this.addon.getChallengesSettings().isRemoveCompleteOneTimeChallenges())
|
||||
{
|
||||
freeChallenges.removeIf(challenge -> !challenge.isRepeatable() &&
|
||||
this.challengesManager.isChallengeComplete(this.user, challenge));
|
||||
}
|
||||
|
||||
final int freeChallengesCount = freeChallenges.size();
|
||||
|
||||
if (freeChallengesCount > 18)
|
||||
@ -208,6 +214,13 @@ public class ChallengesGUI extends CommonGUI
|
||||
if (this.lastSelectedLevel != null)
|
||||
{
|
||||
List<Challenge> challenges = this.challengesManager.getLevelChallenges(this.lastSelectedLevel.getLevel());
|
||||
|
||||
if (this.addon.getChallengesSettings().isRemoveCompleteOneTimeChallenges())
|
||||
{
|
||||
challenges.removeIf(challenge -> !challenge.isRepeatable() &&
|
||||
this.challengesManager.isChallengeComplete(this.user, challenge));
|
||||
}
|
||||
|
||||
final int challengesCount = challenges.size();
|
||||
|
||||
if (challengesCount > 18)
|
||||
|
Loading…
Reference in New Issue
Block a user