Search in sources :

Example 66 with ItemBuilder

use of com.bencodez.advancedcore.api.item.ItemBuilder in project VotingPlugin by Ben12345rocks.

the class AdminVoteCumulativeRemove method onChest.

@Override
public void onChest(Player player) {
    BInventory inv = new BInventory("Remove cumulative");
    inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.Cumulative");
    for (final String votes : plugin.getSpecialRewardsConfig().getCumulativeVotes()) {
        inv.addButton(new BInventoryButton(new ItemBuilder(Material.PAPER, 1).setName(votes).addLoreLine("&c&lClick to remove")) {

            @Override
            public void onClick(ClickEvent clickEvent) {
                new AdminVoteConfirmation(plugin, clickEvent.getPlayer(), "Remove cumulative " + votes + "?") {

                    @Override
                    public void onConfirm(Player p) {
                        plugin.getSpecialRewardsConfig().removeCumulative(votes);
                        p.sendMessage("Removed cumulative " + votes);
                        plugin.reload();
                    }

                    @Override
                    public void onDeny(Player p) {
                        new AdminVoteCumulative(plugin, p);
                    }
                }.open();
            }
        });
    }
    inv.openInventory(player);
}
Also used : ItemBuilder(com.bencodez.advancedcore.api.item.ItemBuilder) Player(org.bukkit.entity.Player) AdminVoteConfirmation(com.bencodez.votingplugin.commands.gui.admin.AdminVoteConfirmation) BInventoryButton(com.bencodez.advancedcore.api.inventory.BInventoryButton) ClickEvent(com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent) BInventory(com.bencodez.advancedcore.api.inventory.BInventory)

Example 67 with ItemBuilder

use of com.bencodez.advancedcore.api.item.ItemBuilder in project VotingPlugin by Ben12345rocks.

the class AdminVoteMilestoneRemove method onChest.

@Override
public void onChest(Player player) {
    BInventory inv = new BInventory("Remove milestones");
    inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.MileStones");
    for (final String votes : plugin.getSpecialRewardsConfig().getMilestoneVotes()) {
        inv.addButton(new BInventoryButton(new ItemBuilder(Material.PAPER, 1).setName(votes).addLoreLine("&c&lClick to remove")) {

            @Override
            public void onClick(ClickEvent clickEvent) {
                new AdminVoteConfirmation(plugin, clickEvent.getPlayer(), "Remove milestone " + votes + "?") {

                    @Override
                    public void onConfirm(Player p) {
                        plugin.getSpecialRewardsConfig().removeMilestone(votes);
                        p.sendMessage("Removed milestone " + votes);
                        plugin.reload();
                    }

                    @Override
                    public void onDeny(Player p) {
                        new AdminVoteMilestones(plugin, p);
                    }
                }.open();
            }
        });
    }
    inv.openInventory(player);
}
Also used : ItemBuilder(com.bencodez.advancedcore.api.item.ItemBuilder) Player(org.bukkit.entity.Player) AdminVoteConfirmation(com.bencodez.votingplugin.commands.gui.admin.AdminVoteConfirmation) BInventoryButton(com.bencodez.advancedcore.api.inventory.BInventoryButton) ClickEvent(com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent) BInventory(com.bencodez.advancedcore.api.inventory.BInventory)

Example 68 with ItemBuilder

use of com.bencodez.advancedcore.api.item.ItemBuilder in project VotingPlugin by Ben12345rocks.

the class AdminVoteMilestones method onChest.

@Override
public void onChest(Player player) {
    BInventory inv = new BInventory("Edit MileStones");
    inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.MileStones");
    inv.addButton(new BInventoryButton(new ItemBuilder(Material.PAPER).setName("&cEdit existing milestone rewards")) {

        @Override
        public void onClick(ClickEvent clickEvent) {
            ArrayList<Integer> nums = new ArrayList<Integer>();
            for (String num : plugin.getSpecialRewardsConfig().getMilestoneVotes()) {
                if (StringParser.getInstance().isInt(num)) {
                    nums.add(Integer.parseInt(num));
                }
            }
            Number[] options = new Number[nums.size()];
            for (int i = 0; i < nums.size(); i++) {
                options[i] = nums.get(i);
            }
            new ValueRequestBuilder(new NumberListener() {

                @Override
                public void onInput(Player player, Number value) {
                    RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(), plugin.getRewardHandler().getDirectlyDefined("MileStones." + value.intValue() + ".Rewards"));
                }
            }, options).allowCustomOption(false).usingMethod(InputMethod.INVENTORY).request(clickEvent.getPlayer());
        }
    });
    inv.addButton(new BInventoryButton(new ItemBuilder(Material.EMERALD_BLOCK).setName("&aAdd milestone")) {

        @Override
        public void onClick(ClickEvent clickEvent) {
            new ValueRequest().requestNumber(player, new NumberListener() {

                @Override
                public void onInput(Player player, Number value) {
                    plugin.getSpecialRewardsConfig().setMilestone(value.intValue());
                    plugin.reload();
                }
            });
        }
    });
    inv.addButton(new BInventoryButton(new ItemBuilder(Material.REDSTONE_BLOCK).setName("&cRemove milestone")) {

        @Override
        public void onClick(ClickEvent clickEvent) {
            new AdminVoteMilestoneRemove(plugin, clickEvent.getPlayer()).open();
        }
    });
    inv.openInventory(player);
}
Also used : Player(org.bukkit.entity.Player) BInventoryButton(com.bencodez.advancedcore.api.inventory.BInventoryButton) ClickEvent(com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent) ArrayList(java.util.ArrayList) BInventory(com.bencodez.advancedcore.api.inventory.BInventory) ValueRequest(com.bencodez.advancedcore.api.valuerequest.ValueRequest) ValueRequestBuilder(com.bencodez.advancedcore.api.valuerequest.ValueRequestBuilder) ItemBuilder(com.bencodez.advancedcore.api.item.ItemBuilder) NumberListener(com.bencodez.advancedcore.api.valuerequest.listeners.NumberListener)

Example 69 with ItemBuilder

use of com.bencodez.advancedcore.api.item.ItemBuilder in project VotingPlugin by Ben12345rocks.

the class AdminVoteVoteShop method onChest.

@Override
public void onChest(Player player) {
    BInventory inv = new BInventory("Edit VoteShop");
    inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.VoteShop");
    inv.addButton(new BInventoryButton(new ItemBuilder(Material.DIAMOND).setName("&cEdit existing item")) {

        @Override
        public void onClick(ClickEvent clickEvent) {
            new AdminVoteVoteShopItems(plugin, clickEvent.getPlayer()).open(GUIMethod.CHEST);
        }
    });
    inv.addButton(new BInventoryButton(new ItemBuilder(Material.EMERALD_BLOCK).setName("&aAdd voteshop item")) {

        @Override
        public void onClick(ClickEvent clickEvent) {
            new ValueRequest().requestString(player, new StringListener() {

                @Override
                public void onInput(Player player, String value) {
                    plugin.getGui().createShop(value);
                    plugin.reload();
                }
            });
        }
    });
    inv.addButton(new BInventoryButton(new ItemBuilder(Material.REDSTONE_BLOCK).setName("&cRemove item")) {

        @Override
        public void onClick(ClickEvent clickEvent) {
            new AdminVoteVoteShopItemRemove(plugin, clickEvent.getPlayer()).open();
        }
    });
    inv.openInventory(player);
}
Also used : ItemBuilder(com.bencodez.advancedcore.api.item.ItemBuilder) Player(org.bukkit.entity.Player) BInventoryButton(com.bencodez.advancedcore.api.inventory.BInventoryButton) ClickEvent(com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent) BInventory(com.bencodez.advancedcore.api.inventory.BInventory) ValueRequest(com.bencodez.advancedcore.api.valuerequest.ValueRequest) StringListener(com.bencodez.advancedcore.api.valuerequest.listeners.StringListener)

Example 70 with ItemBuilder

use of com.bencodez.advancedcore.api.item.ItemBuilder in project VotingPlugin by Ben12345rocks.

the class AdminVoteVoteShopItemRemove method onChest.

@Override
public void onChest(Player player) {
    BInventory inv = new BInventory("Edit VoteShop Remove Item");
    inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.VoteShop");
    for (final String identifier : plugin.getGui().getChestShopIdentifiers()) {
        inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestShopIdentifierSection(identifier)).addLoreLine("&c&lClick to remove")) {

            @Override
            public void onClick(ClickEvent clickEvent) {
                new AdminVoteConfirmation(plugin, clickEvent.getPlayer(), "Remove shop item " + identifier + "?") {

                    @Override
                    public void onConfirm(Player p) {
                        plugin.getGui().removeShop(identifier);
                        p.sendMessage("Removed " + identifier);
                        plugin.reload();
                    }

                    @Override
                    public void onDeny(Player p) {
                        new AdminVoteVoteShop(plugin, p).open();
                    }
                }.open();
            }
        }.addData("ident", identifier));
    }
    inv.openInventory(player);
}
Also used : ItemBuilder(com.bencodez.advancedcore.api.item.ItemBuilder) Player(org.bukkit.entity.Player) AdminVoteConfirmation(com.bencodez.votingplugin.commands.gui.admin.AdminVoteConfirmation) BInventoryButton(com.bencodez.advancedcore.api.inventory.BInventoryButton) ClickEvent(com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent) BInventory(com.bencodez.advancedcore.api.inventory.BInventory)

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