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