Add last missing element in AdminGUI.

Now AdminGUI all icons are functional.
This commit is contained in:
BONNe 2019-01-18 19:26:03 +02:00
parent c2b809f509
commit 1ecbac43bf
2 changed files with 71 additions and 2 deletions

View File

@ -544,4 +544,28 @@ public class ChallengesManager {
{
}
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();
}
}

View File

@ -7,6 +7,7 @@ import org.bukkit.inventory.ItemStack;
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;
@ -189,7 +190,29 @@ public class AdminGUI extends CommonGUI
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;
};
@ -203,7 +226,29 @@ public class AdminGUI extends CommonGUI
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;
};