Search in sources :

Example 31 with BInventoryButton

use of com.bencodez.advancedcore.api.inventory.BInventoryButton 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 32 with BInventoryButton

use of com.bencodez.advancedcore.api.inventory.BInventoryButton 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 33 with BInventoryButton

use of com.bencodez.advancedcore.api.inventory.BInventoryButton 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 34 with BInventoryButton

use of com.bencodez.advancedcore.api.inventory.BInventoryButton 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)

Example 35 with BInventoryButton

use of com.bencodez.advancedcore.api.inventory.BInventoryButton in project AdvancedCore by BenCodez.

the class ChoiceGUI method openClaimChoices.

public void openClaimChoices(Player player) {
    AdvancedCoreUser user = plugin.getUserManager().getUser(player);
    BInventory inv = new BInventory("UnClaimed Choices");
    ArrayList<String> choices = user.getUnClaimedChoices();
    Set<String> unClaimedChoices = new HashSet<String>();
    for (String str : choices) {
        unClaimedChoices.add(str);
    }
    for (String rewardName : unClaimedChoices) {
        Reward reward = plugin.getRewardHandler().getReward(rewardName);
        if (reward.getConfig().getEnableChoices()) {
            inv.addButton(new BInventoryButton(new ItemBuilder(reward.getConfig().getDisplayItem())) {

                @Override
                public void onClick(ClickEvent clickEvent) {
                    openClaimChoices(clickEvent.getPlayer(), (Reward) getData("Reward"));
                }
            }.addData("Reward", reward));
        }
    }
    inv.openInventory(player);
}
Also used : AdvancedCoreUser(com.bencodez.advancedcore.api.user.AdvancedCoreUser) ItemBuilder(com.bencodez.advancedcore.api.item.ItemBuilder) BInventoryButton(com.bencodez.advancedcore.api.inventory.BInventoryButton) ClickEvent(com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent) BInventory(com.bencodez.advancedcore.api.inventory.BInventory) Reward(com.bencodez.advancedcore.api.rewards.Reward) HashSet(java.util.HashSet)

Aggregations

BInventoryButton (com.bencodez.advancedcore.api.inventory.BInventoryButton)66 ClickEvent (com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent)65 ItemBuilder (com.bencodez.advancedcore.api.item.ItemBuilder)57 EditGUI (com.bencodez.advancedcore.api.inventory.editgui.EditGUI)33 Player (org.bukkit.entity.Player)32 BInventory (com.bencodez.advancedcore.api.inventory.BInventory)31 RewardEditData (com.bencodez.advancedcore.api.rewards.RewardEditData)29 EditGUIValueInventory (com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueInventory)26 ArrayList (java.util.ArrayList)15 ValueRequestBuilder (com.bencodez.advancedcore.api.valuerequest.ValueRequestBuilder)11 EditGUIValueString (com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueString)10 StringListener (com.bencodez.advancedcore.api.valuerequest.listeners.StringListener)10 ItemStack (org.bukkit.inventory.ItemStack)10 ValueRequest (com.bencodez.advancedcore.api.valuerequest.ValueRequest)9 EditGUIButton (com.bencodez.advancedcore.api.inventory.editgui.EditGUIButton)8 UpdatingBInventoryButton (com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton)7 Reward (com.bencodez.advancedcore.api.rewards.Reward)7 AdvancedCoreUser (com.bencodez.advancedcore.api.user.AdvancedCoreUser)7 VoteSite (com.bencodez.votingplugin.objects.VoteSite)7 NumberListener (com.bencodez.advancedcore.api.valuerequest.listeners.NumberListener)5