Search in sources :

Example 21 with ClickEvent

use of com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent 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 22 with ClickEvent

use of com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent 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 23 with ClickEvent

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

Example 24 with ClickEvent

use of com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent in project VotingPlugin by Ben12345rocks.

the class VoteNext method onChest.

@Override
public void onChest(Player player) {
    BInventory inv = new BInventory(plugin.getGui().getChestVoteNextName());
    inv.addPlaceholder("player", user.getPlayerName());
    for (VoteSite site : plugin.getVoteSites()) {
        if (!site.isHidden()) {
            inv.addButton(inv.getNextSlot(), new UpdatingBInventoryButton(site.getItem().setName(site.getDisplayName()).setLore(user.voteCommandNextInfo(site)).setAmountNone(1), 1000, 1000) {

                @Override
                public void onClick(ClickEvent clickEvent) {
                }

                @Override
                public ItemBuilder onUpdate(Player player) {
                    return site.getItem().setName(site.getDisplayName()).setLore(user.voteCommandNextInfo(site)).setAmountNone(1).addPlaceholder("player", user.getPlayerName());
                }
            });
        }
    }
    if (plugin.getGui().getChestVoteNextBackButton()) {
        inv.addButton(plugin.getCommandLoader().getBackButton(user));
    }
    inv.openInventory(player);
}
Also used : VoteSite(com.bencodez.votingplugin.objects.VoteSite) UpdatingBInventoryButton(com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton) Player(org.bukkit.entity.Player) ItemBuilder(com.bencodez.advancedcore.api.item.ItemBuilder) ClickEvent(com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent) BInventory(com.bencodez.advancedcore.api.inventory.BInventory)

Example 25 with ClickEvent

use of com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent in project VotingPlugin by Ben12345rocks.

the class VoteLast method onChest.

@Override
public void onChest(Player player) {
    BInventory inv = new BInventory(plugin.getGui().getChestVoteLastName());
    inv.addPlaceholder("player", user.getPlayerName());
    for (VoteSite site : plugin.getVoteSites()) {
        if (!site.isHidden()) {
            inv.addButton(inv.getNextSlot(), new UpdatingBInventoryButton(site.getItem().setName(site.getDisplayName()).setLore(user.voteCommandLastGUILine(site)).setAmountNone(1), 1000, 1000) {

                @Override
                public void onClick(ClickEvent clickEvent) {
                }

                @Override
                public ItemBuilder onUpdate(Player p) {
                    return site.getItem().setName(site.getDisplayName()).setLore(user.voteCommandLastGUILine(site)).setAmountNone(1);
                }
            });
        }
    }
    if (plugin.getGui().getChestVoteLastBackButton()) {
        inv.addButton(plugin.getCommandLoader().getBackButton(user));
    }
    inv.openInventory(player);
}
Also used : VoteSite(com.bencodez.votingplugin.objects.VoteSite) UpdatingBInventoryButton(com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton) Player(org.bukkit.entity.Player) ItemBuilder(com.bencodez.advancedcore.api.item.ItemBuilder) ClickEvent(com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent) BInventory(com.bencodez.advancedcore.api.inventory.BInventory)

Aggregations

ClickEvent (com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent)29 ItemBuilder (com.bencodez.advancedcore.api.item.ItemBuilder)26 BInventoryButton (com.bencodez.advancedcore.api.inventory.BInventoryButton)25 BInventory (com.bencodez.advancedcore.api.inventory.BInventory)23 Player (org.bukkit.entity.Player)19 VoteSite (com.bencodez.votingplugin.objects.VoteSite)9 ArrayList (java.util.ArrayList)8 UpdatingBInventoryButton (com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton)6 EditGUIValueString (com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueString)5 ValueRequest (com.bencodez.advancedcore.api.valuerequest.ValueRequest)5 VotingPluginUser (com.bencodez.votingplugin.user.VotingPluginUser)5 EditGUI (com.bencodez.advancedcore.api.inventory.editgui.EditGUI)4 ValueRequestBuilder (com.bencodez.advancedcore.api.valuerequest.ValueRequestBuilder)4 StringListener (com.bencodez.advancedcore.api.valuerequest.listeners.StringListener)4 EditGUIButton (com.bencodez.advancedcore.api.inventory.editgui.EditGUIButton)3 EditGUIValueList (com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueList)3 EditGUIValueNumber (com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueNumber)3 RewardOptions (com.bencodez.advancedcore.api.rewards.RewardOptions)3 NumberListener (com.bencodez.advancedcore.api.valuerequest.listeners.NumberListener)3 RewardEditGUI (com.bencodez.advancedcore.command.gui.RewardEditGUI)3