Search in sources :

Example 6 with UpdatingBInventoryButton

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

Aggregations

BInventory (com.bencodez.advancedcore.api.inventory.BInventory)6 ClickEvent (com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent)6 UpdatingBInventoryButton (com.bencodez.advancedcore.api.inventory.UpdatingBInventoryButton)6 ItemBuilder (com.bencodez.advancedcore.api.item.ItemBuilder)6 Player (org.bukkit.entity.Player)6 VoteSite (com.bencodez.votingplugin.objects.VoteSite)4 BInventoryButton (com.bencodez.advancedcore.api.inventory.BInventoryButton)2 VotingPluginUser (com.bencodez.votingplugin.user.VotingPluginUser)2 RewardBuilder (com.bencodez.advancedcore.api.rewards.RewardBuilder)1 RewardOptions (com.bencodez.advancedcore.api.rewards.RewardOptions)1 TopVoter (com.bencodez.votingplugin.topvoter.TopVoter)1