Skip to content

Commit

Permalink
Add last missing element in AdminGUI.
Browse files Browse the repository at this point in the history
Now AdminGUI all icons are functional.
  • Loading branch information
BONNe committed Jan 18, 2019
1 parent c2b809f commit 1ecbac4
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 2 deletions.
24 changes: 24 additions & 0 deletions src/main/java/world/bentobox/challenges/ChallengesManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -544,4 +544,28 @@ public void resetAllChallenges(User uuid, World world)
{

}


public Challenges createChallenge(String reply)
{
return new Challenges();
}


public boolean validateChallengeUniqueID(World world, String reply)
{
return false;
}


public boolean validateLevelUniqueID(World world, String reply)
{
return false;
}


public ChallengeLevels createLevel(String reply)
{
return new ChallengeLevels();
}
}
49 changes: 47 additions & 2 deletions src/main/java/world/bentobox/challenges/panel/admin/AdminGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.Collections;
import java.util.List;

import net.wesjd.anvilgui.AnvilGUI;
import world.bentobox.bentobox.api.panels.PanelItem;
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
import world.bentobox.bentobox.api.user.User;
Expand Down Expand Up @@ -189,7 +190,29 @@ private PanelItem createButton(Button button)
description = Collections.emptyList();
icon = new ItemStack(Material.BOOK);
clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create AnvilGUI that force to create String for "unique_id"
new AnvilGUI(this.addon.getPlugin(),
this.user.getPlayer(),
"unique_id",
(player, reply) -> {

if (this.addon.getChallengesManager().validateChallengeUniqueID(this.world, reply))
{
new EditChallengeGUI(this.addon,
this.world,
this.user,
this.addon.getChallengesManager().createChallenge(reply),
this.topLabel,
this.permissionPrefix,
this).build();
}
else
{
// TODO: Throw message that uniqueID is not valid.
this.build();
}

return reply;
});

return true;
};
Expand All @@ -203,7 +226,29 @@ private PanelItem createButton(Button button)
description = Collections.emptyList();
icon = new ItemStack(Material.BOOK);
clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create AnvilGUI that force to create String for "unique_id"
new AnvilGUI(this.addon.getPlugin(),
this.user.getPlayer(),
"unique_id",
(player, reply) -> {

if (this.addon.getChallengesManager().validateLevelUniqueID(this.world, reply))
{
new EditLevelGUI(this.addon,
this.world,
this.user,
this.addon.getChallengesManager().createLevel(reply),
this.topLabel,
this.permissionPrefix,
this).build();
}
else
{
// TODO: Throw message that uniqueID is not valid.
this.build();
}

return reply;
});

return true;
};
Expand Down

0 comments on commit 1ecbac4

Please sign in to comment.