Search in sources :

Example 16 with ClickEvent

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

the class AdminGUI method adminGUIButtons.

/**
 * Open admin GUI.
 *
 * @return ArrayList of buttons
 */
public ArrayList<BInventoryButton> adminGUIButtons() {
    ArrayList<BInventoryButton> buttons = new ArrayList<BInventoryButton>();
    buttons.add(new BInventoryButton("&cVoteSites", new String[] { "&cOnly enabled sites are listed in this section", "&cMiddle Click to create" }, new ItemStack(Material.STONE)) {

        @Override
        public void onClick(ClickEvent event) {
            Player player = event.getPlayer();
            if (event.getClick().equals(ClickType.MIDDLE)) {
                new ValueRequest().requestString(player, new StringListener() {

                    @Override
                    public void onInput(Player player, String value) {
                        plugin.getConfigVoteSites().generateVoteSite(value);
                        player.sendMessage("Generated site");
                        plugin.reload();
                    }
                });
            } else {
                openAdminGUIVoteSites(player);
            }
        }
    });
    buttons.add(new BInventoryButton(new ItemBuilder(Material.CHEST, 1).setName("&cEdit VoteShop")) {

        @Override
        public void onClick(ClickEvent clickEvent) {
            new AdminVoteVoteShop(plugin, clickEvent.getPlayer()).open(GUIMethod.CHEST);
        }
    });
    buttons.add(new BInventoryButton(new ItemBuilder(Material.DIAMOND_BLOCK, 1).setName("&cEdit Milestones")) {

        @Override
        public void onClick(ClickEvent clickEvent) {
            new AdminVoteMilestones(plugin, clickEvent.getPlayer()).open(GUIMethod.CHEST);
        }
    });
    buttons.add(new BInventoryButton(new ItemBuilder(Material.COBBLESTONE, 1).setName("&cEdit Cumulative")) {

        @Override
        public void onClick(ClickEvent clickEvent) {
            new AdminVoteCumulative(plugin, clickEvent.getPlayer()).open(GUIMethod.CHEST);
        }
    });
    buttons.add(new BInventoryButton(new ItemBuilder(Material.STONE, 1).setName("&cEdit VoteParty")) {

        @Override
        public void onClick(ClickEvent clickEvent) {
            new AdminVoteVoteParty(plugin, clickEvent.getPlayer()).open(GUIMethod.CHEST);
        }
    });
    buttons.add(new BInventoryButton(new ItemBuilder(Material.STONE, 1).setName("&cEdit FirstVote reward")) {

        @Override
        public void onClick(ClickEvent clickEvent) {
            RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(), RewardHandler.getInstance().getDirectlyDefined("FirstVote"));
        }
    });
    buttons.add(new BInventoryButton(new ItemBuilder(Material.STONE, 1).setName("&cEdit FirstVoteToday reward")) {

        @Override
        public void onClick(ClickEvent clickEvent) {
            RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(), RewardHandler.getInstance().getDirectlyDefined("FirstVoteToday"));
        }
    });
    buttons.add(new BInventoryButton(new ItemBuilder(Material.STONE, 1).setName("&cEdit AllSites reward")) {

        @Override
        public void onClick(ClickEvent clickEvent) {
            RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(), RewardHandler.getInstance().getDirectlyDefined("AllSites"));
        }
    });
    buttons.add(new BInventoryButton(new ItemBuilder(Material.STONE, 1).setName("&cEdit AnySiteRewards")) {

        @Override
        public void onClick(ClickEvent clickEvent) {
            RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(), RewardHandler.getInstance().getDirectlyDefined("AnySiteRewards"));
        }
    });
    buttons.add(new BInventoryButton(new ItemBuilder(Material.STONE, 1).setName("&cEdit EverySiteReward")) {

        @Override
        public void onClick(ClickEvent clickEvent) {
            RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(), RewardHandler.getInstance().getDirectlyDefined("EverySiteReward"));
        }
    });
    buttons.add(new BInventoryButton(new ItemBuilder(Material.STONE, 1).setName("&cEdit BungeeVotePartyRewards")) {

        @Override
        public void onClick(ClickEvent clickEvent) {
            RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(), RewardHandler.getInstance().getDirectlyDefined("BungeeVotePartyRewards"));
        }
    });
    buttons.add(new BInventoryButton(new ItemBuilder("GRASS_BLOCK").setName("&cEdit BungeeSettings.yml")) {

        @Override
        public void onClick(ClickEvent clickEvent) {
            new AdminVoteBungeeSettings(plugin, clickEvent.getPlayer()).open();
        }
    });
    buttons.add(new BInventoryButton("&cReload Plugin", new String[] {}, new ItemStack(Material.BUCKET, 1)) {

        @Override
        public void onClick(ClickEvent event) {
            plugin.reload();
        }
    });
    return buttons;
}
Also used : Player(org.bukkit.entity.Player) AdminVoteCumulative(com.bencodez.votingplugin.commands.gui.admin.cumulative.AdminVoteCumulative) BInventoryButton(com.bencodez.advancedcore.api.inventory.BInventoryButton) ClickEvent(com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent) ArrayList(java.util.ArrayList) EditGUIValueString(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueString) ValueRequest(com.bencodez.advancedcore.api.valuerequest.ValueRequest) AdminVoteVoteParty(com.bencodez.votingplugin.commands.gui.admin.AdminVoteVoteParty) ItemBuilder(com.bencodez.advancedcore.api.item.ItemBuilder) AdminVoteVoteShop(com.bencodez.votingplugin.commands.gui.admin.voteshop.AdminVoteVoteShop) AdminVoteMilestones(com.bencodez.votingplugin.commands.gui.admin.milestones.AdminVoteMilestones) AdminVoteBungeeSettings(com.bencodez.votingplugin.commands.gui.admin.AdminVoteBungeeSettings) StringListener(com.bencodez.advancedcore.api.valuerequest.listeners.StringListener) ItemStack(org.bukkit.inventory.ItemStack)

Example 17 with ClickEvent

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

the class AdminVoteConfirmation method onChest.

@Override
public void onChest(Player player) {
    BInventory inv = new BInventory(title);
    inv.addButton(new BInventoryButton(new ItemBuilder(Material.EMERALD_BLOCK).setName("&aConfirm")) {

        @Override
        public void onClick(ClickEvent clickEvent) {
            onConfirm(clickEvent.getPlayer());
        }
    });
    inv.addButton(new BInventoryButton(new ItemBuilder(Material.REDSTONE_BLOCK).setName("&aCancel")) {

        @Override
        public void onClick(ClickEvent clickEvent) {
            onDeny(clickEvent.getPlayer());
        }
    });
    inv.openInventory(player);
}
Also used : 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)

Example 18 with ClickEvent

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

use of com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent 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(), RewardHandler.getInstance().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 20 with ClickEvent

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

the class AdminVoteVoteShopItems method onChest.

@Override
public void onChest(Player player) {
    BInventory inv = new BInventory("Edit VoteShop Items");
    inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.VoteShop");
    for (String identifier : plugin.getGui().getChestShopIdentifiers()) {
        inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestShopIdentifierSection(identifier))) {

            @Override
            public void onClick(ClickEvent clickEvent) {
                new AdminVoteVoteShopItem(plugin, clickEvent.getPlayer(), (String) getData("ident")).open(GUIMethod.CHEST);
            }
        }.addData("ident", identifier));
    }
    inv.openInventory(player);
}
Also used : 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)

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