use of com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueBoolean in project VotingPlugin by Ben12345rocks.
the class AdminGUI method openAdminGUIVoteSiteSite.
/**
* Open admin GUI vote site site.
*
* @param player the player
* @param voteSite the vote site
*/
public void openAdminGUIVoteSiteSite(Player player, VoteSite voteSite) {
EditGUI inv = new EditGUI("VoteSite: " + voteSite.getDisplayName());
inv.setMeta(player, "VoteSite", voteSite);
inv.addButton(new BInventoryButton(voteSite.getItem().setName("&cForce vote")) {
@Override
public void onClick(ClickEvent event) {
ArrayList<String> playerNames = new ArrayList<String>();
for (Player p : Bukkit.getOnlinePlayers()) {
playerNames.add(p.getName());
}
new ValueRequestBuilder(new StringListener() {
@Override
public void onInput(Player player, String value) {
Object ob = PlayerUtils.getInstance().getPlayerMeta(player, "VoteSite");
if (ob != null) {
VoteSite site = (VoteSite) ob;
PlayerVoteEvent voteEvent = new PlayerVoteEvent(site, value, site.getServiceSite(), false);
plugin.getServer().getPluginManager().callEvent(voteEvent);
}
}
}, ArrayUtils.getInstance().convert(playerNames)).usingMethod(InputMethod.INVENTORY).allowCustomOption(true).request(event.getWhoClicked());
}
});
inv.addButton(new EditGUIButton(new EditGUIValueNumber("Priority", voteSite.getPriority()) {
@Override
public void setValue(Player player, Number num) {
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
plugin.getConfigVoteSites().setPriority(voteSite.getKey(), num.intValue());
plugin.reload();
}
}));
inv.addButton(new EditGUIButton(new EditGUIValueString("ServiceSite", voteSite.getServiceSite()) {
@Override
public void setValue(Player player, String value) {
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
String siteName = voteSite.getKey();
plugin.getConfigVoteSites().setServiceSite(siteName, value);
plugin.reload();
}
}));
inv.addButton(new EditGUIButton(new EditGUIValueString("Name", voteSite.getDisplayName()) {
@Override
public void setValue(Player player, String value) {
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
plugin.getConfigVoteSites().setDisplayName(voteSite.getKey(), value);
plugin.reload();
}
}));
inv.addButton(new EditGUIButton(new EditGUIValueString("VoteURL", voteSite.getVoteURL()) {
@Override
public void setValue(Player player, String value) {
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
String siteName = voteSite.getKey();
plugin.getConfigVoteSites().setVoteURL(siteName, value);
plugin.reload();
}
}));
inv.addButton(new EditGUIButton(new EditGUIValueNumber("VoteDelay", voteSite.getVoteDelay()) {
@Override
public void setValue(Player player, Number num) {
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
String siteName = voteSite.getKey();
plugin.getConfigVoteSites().setVoteDelay(siteName, num.intValue());
plugin.reload();
}
}));
inv.addButton(new EditGUIButton(new EditGUIValueNumber("VoteDelayMin", voteSite.getVoteDelay()) {
@Override
public void setValue(Player player, Number num) {
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
String siteName = voteSite.getKey();
plugin.getConfigVoteSites().setVoteDelay(siteName, num.intValue());
plugin.reload();
}
}));
inv.addButton(new EditGUIButton(new EditGUIValueBoolean("Enabled", voteSite.isEnabled()) {
@Override
public void setValue(Player player, boolean value) {
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
String siteName = voteSite.getKey();
plugin.getConfigVoteSites().setEnabled(siteName, value);
plugin.reload();
}
}));
inv.addButton(new EditGUIButton(new EditGUIValueBoolean("ForceOffline", voteSite.isGiveOffline()) {
@Override
public void setValue(Player player, boolean value) {
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
String siteName = voteSite.getKey();
plugin.getConfigVoteSites().setForceOffline(siteName, value);
plugin.reload();
}
}));
inv.addButton(new EditGUIButton(new EditGUIValueBoolean("VoteDelayDaily", voteSite.isVoteDelayDaily()) {
@Override
public void setValue(Player player, boolean value) {
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
String siteName = voteSite.getKey();
plugin.getConfigVoteSites().setVoteDelayDaily(siteName, value);
plugin.reload();
}
}));
if (voteSite.getSiteData().isList("Rewards")) {
inv.addButton(new EditGUIButton(new EditGUIValueList("Rewards", voteSite.getSiteData().getStringList("Rewards")) {
@Override
public void setValue(Player p, ArrayList<String> rewards) {
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
plugin.getConfigVoteSites().set(voteSite.getKey(), "Rewards", rewards);
plugin.reload();
}
}));
} else {
inv.addButton(new BInventoryButton(new ItemBuilder(Material.DISPENSER, 1).setName("&cRewards")) {
@Override
public void onClick(ClickEvent clickEvent) {
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(), RewardHandler.getInstance().getDirectlyDefined("VoteSites." + voteSite.getKey() + ".Rewards"));
}
});
}
inv.openInventory(player);
}
use of com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueBoolean in project VotingPlugin by Ben12345rocks.
the class AdminVoteBungeeSettings method onChest.
@Override
public void onChest(Player player) {
EditGUI inv = new EditGUI("Edit BungeeSettings");
inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.BungeeSettings");
inv.addButton(new EditGUIButton(new EditGUIValueBoolean("UseBungeecord", plugin.getBungeeSettings().isUseBungeecoord()) {
@Override
public void setValue(Player player, boolean value) {
setPathData(getKey(), value);
}
}));
inv.addButton(new EditGUIButton(new EditGUIValueString("BungeeMethod", plugin.getBungeeSettings().getBungeeMethod()) {
@Override
public void setValue(Player player, String value) {
setPathData(getKey(), value);
}
}).addOptions("PLUGINMESSAGING", "SOCKETS", "MYSQL"));
inv.addButton(new EditGUIButton(new EditGUIValueBoolean("BungeeDebug", plugin.getBungeeSettings().isBungeeDebug()) {
@Override
public void setValue(Player player, boolean value) {
setPathData(getKey(), value);
}
}));
inv.addButton(new EditGUIButton(new EditGUIValueBoolean("BungeeBroadcast", plugin.getBungeeSettings().isBungeeBroadcast()) {
@Override
public void setValue(Player player, boolean value) {
setPathData(getKey(), value);
}
}.addLore("Triggers a broadcast for the entire network, most cases it is best for this to be false")));
inv.addButton(new EditGUIButton(new EditGUIValueBoolean("BungeeBroadcastAlways", plugin.getBungeeSettings().isBungeeBroadcastAlways()) {
@Override
public void setValue(Player player, boolean value) {
setPathData(getKey(), value);
}
}.addLore("Whether or not to broadcast on cached votes").addLore("PLUGINMESSAGING ONLY")));
inv.addButton(new EditGUIButton(new EditGUIValueBoolean("PerServerRewards", plugin.getBungeeSettings().isPerServerRewards()) {
@Override
public void setValue(Player player, boolean value) {
setPathData(getKey(), value);
}
}));
inv.addButton(new EditGUIButton(new EditGUIValueBoolean("PerServerMilestones", plugin.getBungeeSettings().isPerServerMilestones()) {
@Override
public void setValue(Player player, boolean value) {
setPathData(getKey(), value);
}
}));
inv.addButton(new EditGUIButton(new EditGUIValueBoolean("PerServerPoints", plugin.getBungeeSettings().isPerServerPoints()) {
@Override
public void setValue(Player player, boolean value) {
setPathData(getKey(), value);
}
}));
inv.addButton(new EditGUIButton(new EditGUIValueBoolean("TriggerVotifierEvent", plugin.getBungeeSettings().isTriggerVotifierEvent()) {
@Override
public void setValue(Player player, boolean value) {
setPathData(getKey(), value);
}
}));
inv.addButton(new EditGUIButton(new EditGUIValueString("Server", plugin.getBungeeSettings().getServer()) {
@Override
public void setValue(Player player, String value) {
setPathData(getKey(), value);
}
}.addLore("Server name as stated in proxy")));
inv.openInventory(player);
}
use of com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueBoolean in project VotingPlugin by Ben12345rocks.
the class AdminVoteVoteParty method onChest.
@Override
public void onChest(Player player) {
EditGUI inv = new EditGUI("Edit VoteParty");
inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.VoteParty");
// to add
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueBoolean("Enabled", plugin.getSpecialRewardsConfig().getVotePartyEnabled()) {
@Override
public void setValue(Player player, boolean name) {
setPathData(getKey(), name);
}
}));
inv.addButton(new EditGUIButton(new ItemBuilder(Material.EMERALD, 1), new EditGUIValueNumber("VotesRequired", plugin.getSpecialRewardsConfig().getVotePartyVotesRequired()) {
@Override
public void setValue(Player player, Number num) {
setPathData(getKey(), num.intValue());
}
}));
inv.addButton(new EditGUIButton(new ItemBuilder(Material.LADDER, 1), new EditGUIValueNumber("IncreaseVotesRquired", plugin.getSpecialRewardsConfig().getVotePartyIncreaseVotesRquired()) {
@Override
public void setValue(Player player, Number num) {
setPathData(getKey(), num.intValue());
}
}));
inv.addButton(new BInventoryButton(new ItemBuilder(Material.LADDER).setName("&cCurrent increase amount").addLoreLine("&cCurrent value: " + plugin.getServerData().getVotePartyExtraRequired())) {
@Override
public void onClick(ClickEvent clickEvent) {
new ValueRequestBuilder(new NumberListener() {
@Override
public void onInput(Player player, Number value) {
plugin.getServerData().setVotePartyExtraRequired(value.intValue());
}
}, new Number[] { 0, 10, 50, 100 }).currentValue("" + plugin.getServerData().getVotePartyExtraRequired()).allowCustomOption(true).request(clickEvent.getPlayer());
}
});
inv.addButton(new EditGUIButton(new ItemBuilder(Material.EMERALD, 1), new EditGUIValueNumber("UserVotesRequired", plugin.getSpecialRewardsConfig().getVotePartyUserVotesRequired()) {
@Override
public void setValue(Player player, Number num) {
setPathData(getKey(), num.intValue());
}
}));
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueBoolean("GiveAllPlayers", plugin.getSpecialRewardsConfig().getVotePartyGiveAllPlayers()) {
@Override
public void setValue(Player player, boolean name) {
setPathData(getKey(), name);
}
}));
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueBoolean("GiveOnlinePlayersOnly", plugin.getSpecialRewardsConfig().isVotePartyGiveOnlinePlayersOnly()) {
@Override
public void setValue(Player player, boolean name) {
setPathData(getKey(), name);
}
}));
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueBoolean("ResetEachDay", plugin.getSpecialRewardsConfig().getVotePartyResetEachDay()) {
@Override
public void setValue(Player player, boolean name) {
setPathData(getKey(), name);
}
}));
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueBoolean("ResetWeekly", plugin.getSpecialRewardsConfig().getVotePartyResetWeekly()) {
@Override
public void setValue(Player player, boolean name) {
setPathData(getKey(), name);
}
}));
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueBoolean("ResetMonthly", plugin.getSpecialRewardsConfig().getVotePartyResetMontly()) {
@Override
public void setValue(Player player, boolean name) {
setPathData(getKey(), name);
}
}));
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueBoolean("OnlyOncePerDay", plugin.getSpecialRewardsConfig().getVotePartyOnlyOncePerDay()) {
@Override
public void setValue(Player player, boolean name) {
setPathData(getKey(), name);
}
}));
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueBoolean("ResetExtraVotesMonthly", plugin.getSpecialRewardsConfig().isVotePartyResetExtraVotesMonthly()) {
@Override
public void setValue(Player player, boolean name) {
setPathData(getKey(), name);
}
}));
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueBoolean("CountFakeVotes", plugin.getSpecialRewardsConfig().getVotePartyCountFakeVotes()) {
@Override
public void setValue(Player player, boolean name) {
setPathData(getKey(), name);
}
}));
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueBoolean("CountOfflineVotes", plugin.getSpecialRewardsConfig().getVotePartyCountOfflineVotes()) {
@Override
public void setValue(Player player, boolean name) {
setPathData(getKey(), name);
}
}));
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueString("Broadcast", plugin.getSpecialRewardsConfig().getVotePartyBroadcast()) {
@Override
public void setValue(Player player, String name) {
setPathData(getKey(), name);
}
}));
inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueList("Commands", plugin.getSpecialRewardsConfig().getVotePartyCommands()) {
@Override
public void setValue(Player player, ArrayList<String> value) {
setPathData(getKey(), value);
}
}));
inv.addButton(new BInventoryButton(new ItemBuilder(Material.DISPENSER, 1).setName("&cRewards").addLoreLine("&aUse this for per player rewards, also set online only rewards here as well").addLoreLine("&cTo set rewards to be given to players online only, set RewardType to ONLINE")) {
@Override
public void onClick(ClickEvent clickEvent) {
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(), RewardHandler.getInstance().getDirectlyDefined("VoteParty.Rewards"));
}
});
// implement item reward?
inv.openInventory(player);
}
Aggregations