diff --git a/src/main/java/world/bentobox/challenges/ChallengesManager.java b/src/main/java/world/bentobox/challenges/ChallengesManager.java index 4d03187..e4972c7 100644 --- a/src/main/java/world/bentobox/challenges/ChallengesManager.java +++ b/src/main/java/world/bentobox/challenges/ChallengesManager.java @@ -554,7 +554,7 @@ public class ChallengesManager { public boolean validateChallengeUniqueID(World world, String reply) { - return false; + return true; } @@ -568,4 +568,16 @@ public class ChallengesManager { { return new ChallengeLevels(); } + + + public void unlinkChallenge(ChallengeLevels challengeLevel, Challenges value) + { + + } + + + public void linkChallenge(ChallengeLevels challengeLevel, Challenges value) + { + + } } diff --git a/src/main/java/world/bentobox/challenges/panel/admin/EditLevelGUI.java b/src/main/java/world/bentobox/challenges/panel/admin/EditLevelGUI.java index 22b92ba..fec1e01 100644 --- a/src/main/java/world/bentobox/challenges/panel/admin/EditLevelGUI.java +++ b/src/main/java/world/bentobox/challenges/panel/admin/EditLevelGUI.java @@ -15,11 +15,13 @@ import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder; import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.util.ItemParser; import world.bentobox.challenges.ChallengesAddon; +import world.bentobox.challenges.ChallengesManager; import world.bentobox.challenges.database.object.ChallengeLevels; import world.bentobox.challenges.database.object.Challenges; import world.bentobox.challenges.panel.CommonGUI; import world.bentobox.challenges.panel.util.ItemSwitchGUI; import world.bentobox.challenges.panel.util.NumberGUI; +import world.bentobox.challenges.panel.util.SelectChallengeGUI; import world.bentobox.challenges.panel.util.StringListGUI; @@ -523,8 +525,20 @@ public class EditLevelGUI extends CommonGUI description = Collections.emptyList(); icon = new ItemStack(Material.WATER_BUCKET); clickHandler = (panel, user, clickType, slot) -> { - // TODO: Create Challenge List GUI - this.build(); + ChallengesManager manager = this.addon.getChallengesManager(); + + // Get all challenge that is not in current challenge. + List challengeList = manager.getChallengesList(); + challengeList.removeAll(manager.getChallenges(this.challengeLevel)); + + new SelectChallengeGUI(this.user, challengeList, (status, value) -> { + if (status) + { + manager.linkChallenge(this.challengeLevel, value); + } + + this.build(); + }); return true; }; @@ -537,8 +551,16 @@ public class EditLevelGUI extends CommonGUI description = Collections.emptyList(); icon = new ItemStack(Material.LAVA_BUCKET); clickHandler = (panel, user, clickType, slot) -> { - // TODO: Create Levels List GUI - this.build(); + ChallengesManager manager = this.addon.getChallengesManager(); + + new SelectChallengeGUI(this.user, manager.getChallenges(this.challengeLevel), (status, value) -> { + if (status) + { + manager.unlinkChallenge(this.challengeLevel, value); + } + + this.build(); + }); return true; };