Search in sources :

Example 16 with BInventory

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

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

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

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

Example 20 with BInventory

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

the class VoteStreak method onChest.

@Override
public void onChest(Player player) {
    BInventory inv = new BInventory(plugin.getGui().getChestVoteStreakName());
    inv.addPlaceholder("player", user.getPlayerName());
    inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestVoteStreakCurrentDayStreakItem()).addPlaceholder("Streak", "" + user.getDayVoteStreak())) {

        @Override
        public void onClick(ClickEvent clickEvent) {
        }
    });
    inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestVoteStreakCurrentWeekStreakItem()).addPlaceholder("Streak", "" + user.getWeekVoteStreak())) {

        @Override
        public void onClick(ClickEvent clickEvent) {
        }
    });
    inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestVoteStreakCurrentMonthStreakItem()).addPlaceholder("Streak", "" + user.getMonthVoteStreak())) {

        @Override
        public void onClick(ClickEvent clickEvent) {
        }
    });
    inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestVoteStreakHighestDayStreakItem()).addPlaceholder("Streak", "" + user.getBestDayVoteStreak())) {

        @Override
        public void onClick(ClickEvent clickEvent) {
        }
    });
    inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestVoteStreakHighestWeekStreakItem()).addPlaceholder("Streak", "" + user.getBestWeekVoteStreak())) {

        @Override
        public void onClick(ClickEvent clickEvent) {
        }
    });
    inv.addButton(new BInventoryButton(new ItemBuilder(plugin.getGui().getChestVoteStreakHighestMonthStreakItem()).addPlaceholder("Streak", "" + user.getBestMonthVoteStreak())) {

        @Override
        public void onClick(ClickEvent clickEvent) {
        }
    });
    if (plugin.getGui().getChestVoteStreakBackButton()) {
        inv.addButton(plugin.getCommandLoader().getBackButton(user));
    }
    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

BInventory (com.bencodez.advancedcore.api.inventory.BInventory)23 ClickEvent (com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent)23 ItemBuilder (com.bencodez.advancedcore.api.item.ItemBuilder)21 BInventoryButton (com.bencodez.advancedcore.api.inventory.BInventoryButton)19 Player (org.bukkit.entity.Player)15 VoteSite (com.bencodez.votingplugin.objects.VoteSite)7 UpdatingBInventoryButton (com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton)6 VotingPluginUser (com.bencodez.votingplugin.user.VotingPluginUser)5 ValueRequest (com.bencodez.advancedcore.api.valuerequest.ValueRequest)4 ArrayList (java.util.ArrayList)4 RewardOptions (com.bencodez.advancedcore.api.rewards.RewardOptions)3 AdminVoteConfirmation (com.bencodez.votingplugin.commands.gui.admin.AdminVoteConfirmation)3 TopVoterPlayer (com.bencodez.votingplugin.topvoter.TopVoterPlayer)3 HashMap (java.util.HashMap)3 ValueRequestBuilder (com.bencodez.advancedcore.api.valuerequest.ValueRequestBuilder)2 NumberListener (com.bencodez.advancedcore.api.valuerequest.listeners.NumberListener)2 StringListener (com.bencodez.advancedcore.api.valuerequest.listeners.StringListener)2 TopVoter (com.bencodez.votingplugin.topvoter.TopVoter)2 Entry (java.util.Map.Entry)2 ItemStack (org.bukkit.inventory.ItemStack)2