Skip to content

Commit

Permalink
Implement Reset and Complete Challenge for ListUsersGUI.
Browse files Browse the repository at this point in the history
  • Loading branch information
BONNe committed Jan 19, 2019
1 parent be7435f commit 88f9d32
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
12 changes: 12 additions & 0 deletions src/main/java/world/bentobox/challenges/ChallengesManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -580,4 +580,16 @@ public void linkChallenge(ChallengeLevels challengeLevel, Challenges value)
{

}


public void resetChallenge(UUID uniqueId, Challenges value)
{

}


public void completeChallenge(UUID uniqueId, Challenges value)
{

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.challenges.ChallengesAddon;
import world.bentobox.challenges.ChallengesManager;
import world.bentobox.challenges.panel.CommonGUI;
import world.bentobox.challenges.panel.util.ConfirmationGUI;
import world.bentobox.challenges.panel.util.SelectChallengeGUI;


/**
Expand Down Expand Up @@ -167,19 +169,35 @@ private PanelItem createPlayerIcon(Player player)
{
return new PanelItemBuilder().name(player.getName()).icon(player.getName()).clickHandler(
(panel, user1, clickType, slot) -> {
ChallengesManager manager = this.addon.getChallengesManager();

switch (this.operationMode)
{
case COMPLETE:
// TODO: Open Complete Challenge GUI.
new SelectChallengeGUI(this.user, manager.getChallengesList(), (status, value) -> {
if (status)
{
manager.completeChallenge(player.getUniqueId(), value);
}

this.build();
});
break;
case RESET:
// TODO: Open Reset Challenge GUI.
new SelectChallengeGUI(this.user, manager.getChallengesList(), (status, value) -> {
if (status)
{
manager.resetChallenge(player.getUniqueId(), value);
}

this.build();
});
break;
case RESET_ALL:
new ConfirmationGUI(this.user, status -> {
if (status)
{
this.addon.getChallengesManager().resetAllChallenges(this.user, this.world);
manager.resetAllChallenges(this.user, this.world);
}
});
break;
Expand Down

0 comments on commit 88f9d32

Please sign in to comment.