Search in sources :

Example 31 with ItemBuilder

use of com.bencodez.advancedcore.api.item.ItemBuilder in project AdvancedCore by BenCodez.

the class RewardEditAdvancedWorld method openRename.

public void openRename(Player player, RewardEditData reward) {
    EditGUI inv = new EditGUI("Edit AdvancedWorld Rename: " + reward.getName());
    inv.addData("Reward", reward);
    for (String key : reward.getData().getConfigurationSection("AdvancedWorld").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("AdvancedWorld." + value, reward.getData().getConfigurationSection("AdvancedWorld." + key));
                        reward.setValue("AdvancedWorld." + 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 32 with ItemBuilder

use of com.bencodez.advancedcore.api.item.ItemBuilder in project AdvancedCore by BenCodez.

the class RewardEditAdvancedWorld method openEditSub.

public void openEditSub(Player player, RewardEditData reward) {
    EditGUI inv = new EditGUI("Edit AdvancedWorld World Rewards: " + reward.getName());
    inv.addData("Reward", reward);
    for (String key : reward.getData().getConfigurationSection("AdvancedWorld").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(), "AdvancedWorld." + 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 33 with ItemBuilder

use of com.bencodez.advancedcore.api.item.ItemBuilder in project AdvancedCore by BenCodez.

the class RewardEditChoices method openEditSub.

public void openEditSub(Player player, RewardEditData reward) {
    EditGUI inv = new EditGUI("Edit Choices Edit Sub: " + reward.getName());
    inv.addData("Reward", reward);
    for (String key : reward.getData().getConfigurationSection("Choices").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(), "Choices." + 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 34 with ItemBuilder

use of com.bencodez.advancedcore.api.item.ItemBuilder in project AdvancedCore by BenCodez.

the class RewardEditChoices method openRemove.

public void openRemove(Player player, RewardEditData reward) {
    EditGUI inv = new EditGUI("Edit Choices Remove: " + reward.getName());
    inv.addData("Reward", reward);
    for (String key : reward.getData().getConfigurationSection("Choices").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("Choices." + 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)

Example 35 with ItemBuilder

use of com.bencodez.advancedcore.api.item.ItemBuilder in project AdvancedCore by BenCodez.

the class RewardEditItems method openRemove.

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

            @Override
            public void onClick(ClickEvent clickEvent) {
                RewardEditData reward = (RewardEditData) getInv().getData("Reward");
                reward.setValue("Items." + 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) UpdatingBInventoryButton(com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton) ClickEvent(com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent) EditGUIValueInventory(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueInventory) EditGUIValueString(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueString)

Aggregations

ItemBuilder (com.bencodez.advancedcore.api.item.ItemBuilder)71 ClickEvent (com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent)64 BInventoryButton (com.bencodez.advancedcore.api.inventory.BInventoryButton)57 EditGUI (com.bencodez.advancedcore.api.inventory.editgui.EditGUI)32 Player (org.bukkit.entity.Player)32 EditGUIValueInventory (com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueInventory)30 BInventory (com.bencodez.advancedcore.api.inventory.BInventory)28 RewardEditData (com.bencodez.advancedcore.api.rewards.RewardEditData)28 EditGUIButton (com.bencodez.advancedcore.api.inventory.editgui.EditGUIButton)13 ArrayList (java.util.ArrayList)13 UpdatingBInventoryButton (com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton)11 EditGUIValueString (com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueString)11 ValueRequestBuilder (com.bencodez.advancedcore.api.valuerequest.ValueRequestBuilder)11 StringListener (com.bencodez.advancedcore.api.valuerequest.listeners.StringListener)9 EditGUIValueList (com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueList)7 VoteSite (com.bencodez.votingplugin.objects.VoteSite)7 EditGUIValueNumber (com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueNumber)6 Reward (com.bencodez.advancedcore.api.rewards.Reward)6 AdvancedCoreUser (com.bencodez.advancedcore.api.user.AdvancedCoreUser)6 ValueRequest (com.bencodez.advancedcore.api.valuerequest.ValueRequest)6