Search in sources :

Example 21 with EditGUIValueInventory

use of com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueInventory in project AdvancedCore by BenCodez.

the class RewardEditAdvancedPriority method openRename.

public void openRename(Player player, RewardEditData reward) {
    EditGUI inv = new EditGUI("Edit AdvancedPriority Rename: " + reward.getName());
    inv.addData("Reward", reward);
    for (String key : reward.getData().getConfigurationSection("AdvancedPriority").getKeys(false)) {
        inv.addButton(new BInventoryButton(new ItemBuilder(Material.PAPER).setName("&a" + key).addLoreLine("&aClick to rename")) {

            @Override
            public void onClick(ClickEvent clickEvent) {
                new ValueRequestBuilder(new StringListener() {

                    @Override
                    public void onInput(Player player, String value) {
                        RewardEditData reward = (RewardEditData) getInv().getData("Reward");
                        reward.setValue("AdvancedPriority." + value, reward.getData().getConfigurationSection("AdvancedPriority." + key));
                        reward.setValue("AdvancedPriority." + key, null);
                        reloadAdvancedCore();
                        open(player, reward);
                    }
                }, new String[] {}).usingMethod(InputMethod.CHAT).request(clickEvent.getPlayer());
            }
        });
    }
    inv.addButton(getBackButtonCustom(reward, new EditGUIValueInventory("") {

        @Override
        public void openInventory(ClickEvent clickEvent) {
            RewardEditData reward = (RewardEditData) getInv().getData("Reward");
            open(player, reward);
        }
    }));
    inv.openInventory(player);
}
Also used : EditGUI(com.bencodez.advancedcore.api.inventory.editgui.EditGUI) ItemBuilder(com.bencodez.advancedcore.api.item.ItemBuilder) Player(org.bukkit.entity.Player) RewardEditData(com.bencodez.advancedcore.api.rewards.RewardEditData) BInventoryButton(com.bencodez.advancedcore.api.inventory.BInventoryButton) ClickEvent(com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent) EditGUIValueInventory(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueInventory) StringListener(com.bencodez.advancedcore.api.valuerequest.listeners.StringListener) ValueRequestBuilder(com.bencodez.advancedcore.api.valuerequest.ValueRequestBuilder)

Example 22 with EditGUIValueInventory

use of com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueInventory in project AdvancedCore by BenCodez.

the class RewardEditAdvancedPriority method openEditSub.

public void openEditSub(Player player, RewardEditData reward) {
    EditGUI inv = new EditGUI("Edit AdvancedPriority Edit Sub: " + reward.getName());
    inv.addData("Reward", reward);
    for (String key : reward.getData().getConfigurationSection("AdvancedPriority").getKeys(false)) {
        inv.addButton(new BInventoryButton(new ItemBuilder(Material.PAPER).setName("&a" + key).addLoreLine("&aClick to edit")) {

            @Override
            public void onClick(ClickEvent clickEvent) {
                RewardEditData reward = (RewardEditData) getInv().getData("Reward");
                openSubReward(clickEvent.getPlayer(), "AdvancedPriority." + key, reward);
            }
        });
    }
    inv.addButton(getBackButtonCustom(reward, new EditGUIValueInventory("") {

        @Override
        public void openInventory(ClickEvent clickEvent) {
            RewardEditData reward = (RewardEditData) getInv().getData("Reward");
            open(player, reward);
        }
    }));
    inv.openInventory(player);
}
Also used : EditGUI(com.bencodez.advancedcore.api.inventory.editgui.EditGUI) ItemBuilder(com.bencodez.advancedcore.api.item.ItemBuilder) RewardEditData(com.bencodez.advancedcore.api.rewards.RewardEditData) BInventoryButton(com.bencodez.advancedcore.api.inventory.BInventoryButton) ClickEvent(com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent) EditGUIValueInventory(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueInventory)

Example 23 with EditGUIValueInventory

use of com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueInventory in project AdvancedCore by BenCodez.

the class RewardEditAdvancedRandomReward method open.

@Override
public void open(Player player, RewardEditData reward) {
    EditGUI inv = new EditGUI("Edit AdvancedRandomReward: " + reward.getName());
    inv.addData("Reward", reward);
    inv.addButton(new EditGUIButton(new EditGUIValueInventory("AdvancedRandomReward") {

        @Override
        public void openInventory(ClickEvent clickEvent) {
            new ValueRequestBuilder(new StringListener() {

                @Override
                public void onInput(Player player, String value) {
                    RewardEditData reward = (RewardEditData) getInv().getData("Reward");
                    reward.createSection("AdvancedRandomReward." + value);
                    reloadAdvancedCore();
                    open(player, reward);
                }
            }, new String[] {}).usingMethod(InputMethod.CHAT).request(clickEvent.getPlayer());
        }
    }).setName("&aAdd sub reward"));
    inv.addButton(new EditGUIButton(new EditGUIValueInventory("AdvancedRandomReward") {

        @Override
        public void openInventory(ClickEvent clickEvent) {
            RewardEditData reward = (RewardEditData) getInv().getData("Reward");
            if (reward.hasPath("AdvancedRandomReward")) {
                openRemove(player, reward);
            }
        }
    }).setName("&aRemove sub reward"));
    inv.addButton(new EditGUIButton(new EditGUIValueInventory("AdvancedRandomReward") {

        @Override
        public void openInventory(ClickEvent clickEvent) {
            RewardEditData reward = (RewardEditData) getInv().getData("Reward");
            if (reward.hasPath("AdvancedRandomReward")) {
                openRename(player, reward);
            }
        }
    }).setName("&aRename sub reward"));
    inv.addButton(new EditGUIButton(new EditGUIValueInventory("AdvancedRandomReward") {

        @Override
        public void openInventory(ClickEvent clickEvent) {
            RewardEditData reward = (RewardEditData) getInv().getData("Reward");
            if (reward.hasPath("AdvancedRandomReward")) {
                openEditSub(player, reward);
            }
        }
    }).setName("&aEdit sub reward"));
    inv.addButton(getBackButton(reward));
    inv.openInventory(player);
}
Also used : EditGUI(com.bencodez.advancedcore.api.inventory.editgui.EditGUI) Player(org.bukkit.entity.Player) RewardEditData(com.bencodez.advancedcore.api.rewards.RewardEditData) EditGUIButton(com.bencodez.advancedcore.api.inventory.editgui.EditGUIButton) ClickEvent(com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent) EditGUIValueInventory(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueInventory) StringListener(com.bencodez.advancedcore.api.valuerequest.listeners.StringListener) ValueRequestBuilder(com.bencodez.advancedcore.api.valuerequest.ValueRequestBuilder)

Example 24 with EditGUIValueInventory

use of com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueInventory in project AdvancedCore by BenCodez.

the class RewardEditAdvancedRandomReward method openEditSub.

public void openEditSub(Player player, RewardEditData reward) {
    EditGUI inv = new EditGUI("Edit AdvancedRandomReward Edit Sub: " + reward.getName());
    inv.addData("Reward", reward);
    for (String key : reward.getData().getConfigurationSection("AdvancedRandomReward").getKeys(false)) {
        inv.addButton(new BInventoryButton(new ItemBuilder(Material.PAPER).setName("&a" + key).addLoreLine("&aClick to edit")) {

            @Override
            public void onClick(ClickEvent clickEvent) {
                RewardEditData reward = (RewardEditData) getInv().getData("Reward");
                openSubReward(clickEvent.getPlayer(), "AdvancedRandomReward." + key, reward);
            }
        });
    }
    inv.addButton(getBackButtonCustom(reward, new EditGUIValueInventory("") {

        @Override
        public void openInventory(ClickEvent clickEvent) {
            RewardEditData reward = (RewardEditData) getInv().getData("Reward");
            open(player, reward);
        }
    }));
    inv.openInventory(player);
}
Also used : EditGUI(com.bencodez.advancedcore.api.inventory.editgui.EditGUI) ItemBuilder(com.bencodez.advancedcore.api.item.ItemBuilder) RewardEditData(com.bencodez.advancedcore.api.rewards.RewardEditData) BInventoryButton(com.bencodez.advancedcore.api.inventory.BInventoryButton) ClickEvent(com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent) EditGUIValueInventory(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueInventory)

Example 25 with EditGUIValueInventory

use of com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueInventory in project AdvancedCore by BenCodez.

the class RewardEditAdvancedRandomReward method openRemove.

public void openRemove(Player player, RewardEditData reward) {
    EditGUI inv = new EditGUI("Edit AdvancedRandomReward Remove: " + reward.getName());
    inv.addData("Reward", reward);
    for (String key : reward.getData().getConfigurationSection("AdvancedRandomReward").getKeys(false)) {
        inv.addButton(new BInventoryButton(new ItemBuilder(Material.PAPER).setName("&c" + key).addLoreLine("&cClick to remove")) {

            @Override
            public void onClick(ClickEvent clickEvent) {
                RewardEditData reward = (RewardEditData) getInv().getData("Reward");
                reward.setValue("AdvancedRandomReward." + key, null);
                reloadAdvancedCore();
                open(player, reward);
            }
        });
    }
    inv.addButton(getBackButtonCustom(reward, new EditGUIValueInventory("") {

        @Override
        public void openInventory(ClickEvent clickEvent) {
            RewardEditData reward = (RewardEditData) getInv().getData("Reward");
            open(player, reward);
        }
    }));
    inv.openInventory(player);
}
Also used : EditGUI(com.bencodez.advancedcore.api.inventory.editgui.EditGUI) ItemBuilder(com.bencodez.advancedcore.api.item.ItemBuilder) RewardEditData(com.bencodez.advancedcore.api.rewards.RewardEditData) BInventoryButton(com.bencodez.advancedcore.api.inventory.BInventoryButton) ClickEvent(com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent) EditGUIValueInventory(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueInventory)

Aggregations

EditGUIValueInventory (com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueInventory)39 ClickEvent (com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent)38 EditGUI (com.bencodez.advancedcore.api.inventory.editgui.EditGUI)35 RewardEditData (com.bencodez.advancedcore.api.rewards.RewardEditData)35 ItemBuilder (com.bencodez.advancedcore.api.item.ItemBuilder)30 BInventoryButton (com.bencodez.advancedcore.api.inventory.BInventoryButton)26 Player (org.bukkit.entity.Player)18 EditGUIButton (com.bencodez.advancedcore.api.inventory.editgui.EditGUIButton)14 ValueRequestBuilder (com.bencodez.advancedcore.api.valuerequest.ValueRequestBuilder)13 StringListener (com.bencodez.advancedcore.api.valuerequest.listeners.StringListener)9 EditGUIValueString (com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueString)6 UpdatingBInventoryButton (com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton)5 ArrayList (java.util.ArrayList)5 EditGUIValueList (com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueList)4 NumberListener (com.bencodez.advancedcore.api.valuerequest.listeners.NumberListener)4 FileDirectoryException (com.bencodez.advancedcore.api.exceptions.FileDirectoryException)2 EditGUIValueBoolean (com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueBoolean)2 EditGUIValueNumber (com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueNumber)2 JavascriptEngine (com.bencodez.advancedcore.api.javascript.JavascriptEngine)2 RewardEditAdvancedRandomReward (com.bencodez.advancedcore.api.rewards.editbuttons.RewardEditAdvancedRandomReward)2