use of com.Ben12345rocks.AdvancedCore.Util.Inventory.BInventoryButton in project VotingPlugin by Ben12345rocks.
the class PlayerGUIs method openVoteStreak.
public void openVoteStreak(Player player, User user) {
setSelectedPlayer(player, user);
BInventory inv = new BInventory(StringUtils.getInstance().replacePlaceHolder(Config.getInstance().getGUIVoteStreakName(), "player", user.getPlayerName()));
inv.addButton(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteStreakCurrentDayStreakItem()).addPlaceholder("Streak", "" + user.getDayVoteStreak())) {
@Override
public void onClick(ClickEvent clickEvent) {
}
});
inv.addButton(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteStreakCurrentWeekStreakItem()).addPlaceholder("Streak", "" + user.getWeekVoteStreak())) {
@Override
public void onClick(ClickEvent clickEvent) {
}
});
inv.addButton(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteStreakCurrentMonthStreakItem()).addPlaceholder("Streak", "" + user.getMonthVoteStreak())) {
@Override
public void onClick(ClickEvent clickEvent) {
}
});
inv.addButton(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteStreakHighestDayStreakItem()).addPlaceholder("Streak", "" + user.getBestDayVoteStreak())) {
@Override
public void onClick(ClickEvent clickEvent) {
}
});
inv.addButton(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteStreakHighestWeekStreakItem()).addPlaceholder("Streak", "" + user.getBestWeekVoteStreak())) {
@Override
public void onClick(ClickEvent clickEvent) {
}
});
inv.addButton(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteStreakHighestMonthStreakItem()).addPlaceholder("Streak", "" + user.getBestMonthVoteStreak())) {
@Override
public void onClick(ClickEvent clickEvent) {
}
});
if (Config.getInstance().getGUIVoteStreakBackButton()) {
inv.addButton(new BInventoryButton(getBackButton()) {
@Override
public void onClick(ClickEvent event) {
openVoteGUI(event.getPlayer(), getSelectedPlayer(event.getPlayer()));
}
});
}
inv.openInventory(player);
}
use of com.Ben12345rocks.AdvancedCore.Util.Inventory.BInventoryButton in project VotingPlugin by Ben12345rocks.
the class PlayerGUIs method openVoteNext.
public void openVoteNext(Player player, User user) {
setSelectedPlayer(player, user);
BInventory inv = new BInventory(StringUtils.getInstance().replacePlaceHolder(Config.getInstance().getGUIVoteNextName(), "player", user.getPlayerName()));
for (VoteSite site : plugin.getVoteSites()) {
inv.addButton(inv.getNextSlot(), new BInventoryButton(site.getItem().setName(site.getDisplayName()).setLore(Commands.getInstance().voteCommandNextInfo(user, site)).setAmountNone(1)) {
@Override
public void onClick(ClickEvent clickEvent) {
}
});
}
if (Config.getInstance().getGUIVoteNextBackButton()) {
inv.addButton(new BInventoryButton(getBackButton()) {
@Override
public void onClick(ClickEvent event) {
openVoteGUI(event.getPlayer(), getSelectedPlayer(event.getPlayer()));
}
});
}
inv.openInventory(player);
}
use of com.Ben12345rocks.AdvancedCore.Util.Inventory.BInventoryButton in project VotingPlugin by Ben12345rocks.
the class PlayerGUIs method openVoteTop.
public void openVoteTop(Player player, TopVoter top) {
if (top == null) {
top = TopVoter.getDefault();
}
BInventory inv = null;
Set<Entry<User, Integer>> users = null;
String topVoter = "";
if (top.equals(TopVoter.Monthly)) {
topVoter = Config.getInstance().getFormatTopVoterMonthly();
users = plugin.topVoterMonthly.entrySet();
} else if (top.equals(TopVoter.Weekly)) {
topVoter = Config.getInstance().getFormatTopVoterWeekly();
users = plugin.topVoterWeekly.entrySet();
} else if (top.equals(TopVoter.Daily)) {
topVoter = Config.getInstance().getFormatTopVoterDaily();
users = plugin.topVoterDaily.entrySet();
} else {
topVoter = Config.getInstance().getFormatTopVoterAllTime();
users = plugin.topVoterAllTime.entrySet();
}
inv = new BInventory(StringUtils.getInstance().replacePlaceHolder(Config.getInstance().getGUIVoteTopName(), "topvoter", topVoter));
int pos = 1;
for (Entry<User, Integer> entry : users) {
inv.addButton(new BInventoryButton(new ItemBuilder(MiscUtils.getInstance().setSkullOwner(entry.getKey().getOfflinePlayer())).setName(Config.getInstance().getGUIVoteTopItemName()).addLoreLine(Config.getInstance().getGUIVoteTopItemLore()).addPlaceholder("position", "" + pos).addPlaceholder("player", entry.getKey().getPlayerName()).addPlaceholder("votes", "" + entry.getValue())) {
@Override
public void onClick(ClickEvent clickEvent) {
// ItemBuilder item = new ItemBuilder(clickEvent.getClickedItem());
// String name = ChatColor.stripColor(item.getName()).split(":")[1].trim();
String name = (String) clickEvent.getButton().getData("player");
User user = UserManager.getInstance().getVotingPluginUser(name);
openVoteGUI(player, user);
}
}.addData("player", entry.getKey().getPlayerName()));
pos++;
}
final TopVoter cur = top;
inv.getPageButtons().add(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteTopSwitchItem()).addPlaceholder("Top", topVoter)) {
@Override
public void onClick(ClickEvent clickEvent) {
if (!clickEvent.getClick().equals(ClickType.RIGHT)) {
openVoteTop(player, cur.next());
} else {
openVoteTop(player, cur.prev());
}
}
});
if (Config.getInstance().getGUIVoteTopBackButton()) {
inv.getPageButtons().add(new BInventoryButton(getBackButton().setSlot(1)) {
@Override
public void onClick(ClickEvent event) {
openVoteGUI(event.getPlayer(), getSelectedPlayer(event.getPlayer()));
}
});
}
inv.setPages(true);
inv.setMaxInvSize(Config.getInstance().getGUIVoteTopSize());
inv.openInventory(player);
}
use of com.Ben12345rocks.AdvancedCore.Util.Inventory.BInventoryButton in project VotingPlugin by Ben12345rocks.
the class PlayerGUIs method openVoteURL.
/**
* Vote URL.
*
* @param player
* the player
*/
public void openVoteURL(Player player) {
setSelectedPlayer(player, null);
BInventory inv = new BInventory(Config.getInstance().getGUIVoteURLName());
User user = UserManager.getInstance().getVotingPluginUser(player);
int count = 0;
if (Config.getInstance().getVoteURLViewAllUrlsButtonEnabled()) {
ItemBuilder builderAll = new ItemBuilder(Config.getInstance().getVoteURLAlreadyVotedAllUrlsButtonItemSection());
if (user.canVoteAll()) {
builderAll = new ItemBuilder(Config.getInstance().getVoteURLCanVoteAllUrlsButtonItemSection());
}
if (!builderAll.hasCustomDisplayName()) {
builderAll.setName("&4All Voting Sites");
}
if (!builderAll.hasCustomLore()) {
builderAll.setLore("&cClick Me");
}
inv.addButton(count, new BInventoryButton(builderAll) {
@Override
public void onClick(ClickEvent event) {
User user = UserManager.getInstance().getVotingPluginUser(event.getPlayer());
Player player = event.getWhoClicked();
player.closeInventory();
user.sendMessage(Commands.getInstance().voteURLs(user));
}
});
count++;
}
for (VoteSite voteSite : plugin.getVoteSites()) {
ItemBuilder builder = new ItemBuilder(Config.getInstance().getVoteURLAlreadyVotedItemSection());
if (user.canVoteSite(voteSite)) {
builder = new ItemBuilder(Config.getInstance().getVoteURLCanVoteItemSection());
} else {
builder.addLoreLine(Config.getInstance().getVoteURLNextVote().replace("%Info%", Commands.getInstance().voteCommandNextInfo(user, voteSite)));
}
builder.setName(Config.getInstance().getVoteURLSiteName().replace("%Name%", voteSite.getDisplayName()));
inv.addButton(count, new BInventoryButton(builder) {
@Override
public void onClick(ClickEvent event) {
Player player = event.getWhoClicked();
if (player != null) {
player.closeInventory();
User user = UserManager.getInstance().getVotingPluginUser(player);
user.sendMessage(StringUtils.getInstance().replacePlaceHolder(StringUtils.getInstance().replacePlaceHolder(StringUtils.getInstance().replacePlaceHolder(Config.getInstance().getGUIVoteURLURLText(), "voteurl", voteSite.getVoteURL()), "sitename", voteSite.getDisplayName()), "player", player.getName()));
}
}
});
count++;
}
if (Config.getInstance().getGUIVoteURLBackButton()) {
inv.addButton(new BInventoryButton(getBackButton()) {
@Override
public void onClick(ClickEvent event) {
openVoteGUI(event.getPlayer(), getSelectedPlayer(event.getPlayer()));
}
});
}
inv.openInventory(player);
}
use of com.Ben12345rocks.AdvancedCore.Util.Inventory.BInventoryButton in project VotingPlugin by Ben12345rocks.
the class PlayerGUIs method openVoteTotal.
public void openVoteTotal(Player player, User user) {
setSelectedPlayer(player, user);
BInventory inv = new BInventory(StringUtils.getInstance().replacePlaceHolder(Config.getInstance().getGUIVoteTotalName(), "player", user.getPlayerName()));
inv.addButton(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteTotalDayTotalItem()).addPlaceholder("Total", "" + user.getDailyTotal())) {
@Override
public void onClick(ClickEvent clickEvent) {
}
});
inv.addButton(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteTotalWeekTotalItem()).addPlaceholder("Total", "" + user.getWeeklyTotal())) {
@Override
public void onClick(ClickEvent clickEvent) {
}
});
inv.addButton(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteTotalMonthTotalItem()).addPlaceholder("Total", "" + user.getMonthTotal())) {
@Override
public void onClick(ClickEvent clickEvent) {
}
});
inv.addButton(new BInventoryButton(new ItemBuilder(Config.getInstance().getGUIVoteTotalAllTimeTotalItem()).addPlaceholder("Total", "" + user.getAllTimeTotal())) {
@Override
public void onClick(ClickEvent clickEvent) {
}
});
if (Config.getInstance().getGUIVoteTotalBackButton()) {
inv.addButton(new BInventoryButton(getBackButton()) {
@Override
public void onClick(ClickEvent event) {
openVoteGUI(event.getPlayer(), getSelectedPlayer(event.getPlayer()));
}
});
}
inv.openInventory(player);
}
Aggregations