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);
}
Aggregations