Search in sources :

Example 1 with EditGUIButton

use of com.bencodez.advancedcore.api.inventory.editgui.EditGUIButton in project VotingPlugin by Ben12345rocks.

the class VotingPluginMain method onPostLoad.

@Override
public void onPostLoad() {
    loadVersionFile();
    getOptions().setServer(bungeeSettings.getServer());
    if (bungeeSettings.isUseBungeecoord()) {
        bungeeHandler = new BungeeHandler(this);
        bungeeHandler.load();
        if (getOptions().getServer().equalsIgnoreCase("PleaseSet")) {
            getLogger().warning("Bungeecoord is true and server name is not set, bungeecoord features may not work");
        }
    }
    registerCommands();
    checkVotifier();
    registerEvents();
    loadDirectlyDefined();
    checkUpdate = new CheckUpdate(this);
    checkUpdate.startUp();
    voteReminding = new VoteReminding(this);
    voteReminding.loadRemindChecking();
    specialRewards = new SpecialRewards(this);
    signs = new Signs(this);
    coolDownCheck.checkEnabled();
    coolDownCheck.load();
    Bukkit.getScheduler().runTask(plugin, new Runnable() {

        @Override
        public void run() {
            signs.loadSigns();
        }
    });
    topVoterHandler = new TopVoterHandler(this);
    lastMonthTopVoter = new LinkedHashMap<TopVoterPlayer, Integer>();
    Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {

        @Override
        public void run() {
            topVoterHandler.loadLastMonth();
            debug("Loaded last month top voters");
        }
    });
    topVoter = new LinkedHashMap<TopVoter, LinkedHashMap<TopVoterPlayer, Integer>>();
    for (TopVoter top : TopVoter.values()) {
        topVoter.put(top, new LinkedHashMap<TopVoterPlayer, Integer>());
    }
    voteToday = new LinkedHashMap<TopVoterPlayer, HashMap<VoteSite, LocalDateTime>>();
    voteLog = new Logger(plugin, new File(plugin.getDataFolder() + File.separator + "Log", "votelog.txt"));
    new AdminGUI(this).loadHook();
    // vote party
    voteParty = new VoteParty(this);
    voteParty.register();
    topVoterHandler.register();
    metrics();
    // javascript api
    getJavascriptEngineRequests().add(new JavascriptPlaceholderRequest("User") {

        @Override
        public Object getObject(OfflinePlayer player) {
            return getVotingPluginUserManager().getVotingPluginUser(player);
        }
    });
    getJavascriptEngine().put("VotingPluginHooks", VotingPluginHooks.getInstance());
    loadTimer();
    // placeholderapi loading
    placeholders = new PlaceHolders(this);
    placeholders.load();
    if (Bukkit.getPluginManager().isPluginEnabled("MVdWPlaceholderAPI")) {
        mvdwPlaceholders = new MVdWPlaceholders(this);
        mvdwPlaceholders.loadMVdWPlaceholders();
    }
    // Add rewards
    RewardHandler.getInstance().addInjectedReward(new RewardInjectInt("Points", 0) {

        @Override
        public String onRewardRequest(Reward reward, com.bencodez.advancedcore.api.user.AdvancedCoreUser user, int num, HashMap<String, String> placeholders) {
            UserManager.getInstance().getVotingPluginUser(user).addPoints(num);
            return null;
        }
    }.synchronize().addEditButton(new EditGUIButton(new ItemBuilder(Material.PAPER), new EditGUIValueNumber("Points", null) {

        @Override
        public void setValue(Player player, Number value) {
            RewardEditData reward = (RewardEditData) getInv().getData("Reward");
            reward.setValue("Points", value.intValue());
        }
    }.addLore("Give player voting points"))).validator(new RewardInjectValidator() {

        @Override
        public void onValidate(Reward reward, RewardInject inject, ConfigurationSection data) {
            if (data.getInt(inject.getPath(), -1) == 0) {
                warning(reward, inject, "Points can not be 0");
            }
        }
    }));
    RewardHandler.getInstance().addInjectedReward(new RewardInjectConfigurationSection("VoteBossBar") {

        @Override
        public String onRewardRequested(Reward arg0, com.bencodez.advancedcore.api.user.AdvancedCoreUser user, ConfigurationSection section, HashMap<String, String> placeholders) {
            if (section.getBoolean("Enabled")) {
                user.sendBossBar(StringParser.getInstance().replacePlaceHolder(section.getString("Message", ""), placeholders), section.getString("Color", "BLUE"), section.getString("Style", "SOLID"), (double) UserManager.getInstance().getVotingPluginUser(user).getSitesVotedOn() / plugin.getVoteSites().size(), section.getInt("Delay", 30));
            }
            return null;
        }
    });
    for (final TopVoter top : TopVoter.values()) {
        RewardHandler.getInstance().addPlaceholder(new RewardPlaceholderHandle("Total_" + top.toString()) {

            @Override
            public String getValue(Reward reward, com.bencodez.advancedcore.api.user.AdvancedCoreUser user) {
                VotingPluginUser vUser = UserManager.getInstance().getVotingPluginUser(user);
                return "" + vUser.getTotal(top);
            }
        });
    }
    if (plugin.getConfigFile().isFormatAlternateBroadcastEnabled()) {
        broadcastHandler = new BroadcastHandler(plugin, plugin.getConfigFile().getFormatAlternateBroadcastDelay());
        plugin.debug("Using alternate broadcast method");
    }
    plugin.getLogger().info("Enabled VotingPlugin " + plugin.getDescription().getVersion());
    if (getProfile().contains("dev")) {
        plugin.getLogger().info("Using dev build, this is not a stable build, use at your own risk. Build number: " + buildNumber);
    }
    boolean hasRewards = RewardHandler.getInstance().hasRewards(getConfigVoteSites().getData(), getConfigVoteSites().getEverySiteRewardPath());
    boolean issues = true;
    ArrayList<String> services = serverData.getServiceSites();
    for (VoteSite site : getVoteSites()) {
        if (!site.hasRewards() && !hasRewards) {
            issues = false;
            plugin.getLogger().warning("No rewards detected for the site: " + site.getKey() + ". See https://github.com/BenCodez/VotingPlugin/wiki/Rewards");
        }
        boolean contains = false;
        for (String service : services) {
            if (service.equalsIgnoreCase(site.getServiceSite())) {
                contains = true;
            }
        }
        if (!contains) {
            issues = false;
            plugin.getLogger().warning("No vote has been recieved from " + site.getServiceSite() + ", may be an invalid service site. Please read: https://github.com/BenCodez/VotingPlugin/wiki/Votifier-Troubleshooting");
        }
    }
    if (!issues) {
        Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {

            @Override
            public void run() {
                plugin.getLogger().warning("Detected an issue with voting sites, check the server startup log for more details: https://github.com/BenCodez/VotingPlugin/wiki/Votifier-Troubleshooting");
            }
        }, 30l);
    }
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) VoteReminding(com.bencodez.votingplugin.votereminding.VoteReminding) PlaceHolders(com.bencodez.votingplugin.placeholders.PlaceHolders) LinkedHashMap(java.util.LinkedHashMap) OfflinePlayer(org.bukkit.OfflinePlayer) AdminGUI(com.bencodez.votingplugin.commands.gui.AdminGUI) RewardPlaceholderHandle(com.bencodez.advancedcore.api.rewards.RewardPlaceholderHandle) VoteParty(com.bencodez.votingplugin.voteparty.VoteParty) TopVoterPlayer(com.bencodez.votingplugin.topvoter.TopVoterPlayer) Player(org.bukkit.entity.Player) OfflinePlayer(org.bukkit.OfflinePlayer) TopVoterPlayer(com.bencodez.votingplugin.topvoter.TopVoterPlayer) RewardInjectInt(com.bencodez.advancedcore.api.rewards.injected.RewardInjectInt) MVdWPlaceholders(com.bencodez.votingplugin.placeholders.MVdWPlaceholders) ItemBuilder(com.bencodez.advancedcore.api.item.ItemBuilder) CheckUpdate(com.bencodez.votingplugin.updater.CheckUpdate) EditGUIButton(com.bencodez.advancedcore.api.inventory.editgui.EditGUIButton) EditGUIValueNumber(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueNumber) File(java.io.File) ConfigurationSection(org.bukkit.configuration.ConfigurationSection) RewardInjectConfigurationSection(com.bencodez.advancedcore.api.rewards.injected.RewardInjectConfigurationSection) VotingPluginUser(com.bencodez.votingplugin.user.VotingPluginUser) Logger(com.bencodez.advancedcore.logger.Logger) VoteSite(com.bencodez.votingplugin.objects.VoteSite) TopVoterHandler(com.bencodez.votingplugin.topvoter.TopVoterHandler) EditGUIValueNumber(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueNumber) TopVoter(com.bencodez.votingplugin.topvoter.TopVoter) RewardInjectValidator(com.bencodez.advancedcore.api.rewards.injected.RewardInjectValidator) SpecialRewards(com.bencodez.votingplugin.specialrewards.SpecialRewards) JavascriptPlaceholderRequest(com.bencodez.advancedcore.api.javascript.JavascriptPlaceholderRequest) Signs(com.bencodez.votingplugin.signs.Signs) RewardEditData(com.bencodez.advancedcore.api.rewards.RewardEditData) RewardInjectConfigurationSection(com.bencodez.advancedcore.api.rewards.injected.RewardInjectConfigurationSection) RewardInject(com.bencodez.advancedcore.api.rewards.injected.RewardInject) DirectlyDefinedReward(com.bencodez.advancedcore.api.rewards.DirectlyDefinedReward) Reward(com.bencodez.advancedcore.api.rewards.Reward) BroadcastHandler(com.bencodez.votingplugin.broadcast.BroadcastHandler)

Example 2 with EditGUIButton

use of com.bencodez.advancedcore.api.inventory.editgui.EditGUIButton 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);
}
Also used : EditGUI(com.bencodez.advancedcore.api.inventory.editgui.EditGUI) RewardEditGUI(com.bencodez.advancedcore.command.gui.RewardEditGUI) Player(org.bukkit.entity.Player) EditGUIValueBoolean(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueBoolean) BInventoryButton(com.bencodez.advancedcore.api.inventory.BInventoryButton) ClickEvent(com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent) ArrayList(java.util.ArrayList) EditGUIValueString(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueString) EditGUIValueString(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueString) ValueRequestBuilder(com.bencodez.advancedcore.api.valuerequest.ValueRequestBuilder) VoteSite(com.bencodez.votingplugin.objects.VoteSite) PlayerVoteEvent(com.bencodez.votingplugin.events.PlayerVoteEvent) ItemBuilder(com.bencodez.advancedcore.api.item.ItemBuilder) EditGUIValueList(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueList) EditGUIValueNumber(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueNumber) EditGUIButton(com.bencodez.advancedcore.api.inventory.editgui.EditGUIButton) EditGUIValueNumber(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueNumber) StringListener(com.bencodez.advancedcore.api.valuerequest.listeners.StringListener)

Example 3 with EditGUIButton

use of com.bencodez.advancedcore.api.inventory.editgui.EditGUIButton in project VotingPlugin by Ben12345rocks.

the class AdminVoteVoteShopItem method onChest.

@Override
public void onChest(Player player) {
    EditGUI inv = new EditGUI("Edit VoteShop Item: " + identifier);
    inv.requirePermission("VotingPlugin.Commands.AdminVote.Edit.VoteShop");
    // to add
    inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueString("Identifier_Name", plugin.getGui().getChestShopIdentifierIdentifierName(identifier)) {

        @Override
        public void setValue(Player player, String name) {
            setPathData(getKey(), name);
        }
    }));
    inv.addButton(new EditGUIButton(new ItemBuilder(Material.OAK_DOOR, 1), new EditGUIValueString("Permission", plugin.getGui().getChestVoteShopPermission(identifier)) {

        @Override
        public void setValue(Player player, String name) {
            setPathData(getKey(), name);
        }
    }));
    inv.addButton(new EditGUIButton(new ItemBuilder(Material.EMERALD, 1), new EditGUIValueNumber("Cost", plugin.getGui().getChestShopIdentifierCost(identifier)) {

        @Override
        public void setValue(Player player, Number num) {
            setPathData(getKey(), num.intValue());
        }
    }));
    inv.addButton(new EditGUIButton(new ItemBuilder(Material.BARRIER, 1), new EditGUIValueNumber("Limit", plugin.getGui().getChestShopIdentifierLimit(identifier)) {

        @Override
        public void setValue(Player player, Number num) {
            setPathData(getKey(), num.intValue());
        }
    }));
    // display item
    ConfigurationSection displayItemData = plugin.getGui().getChestShopIdentifierSection(identifier);
    inv.addButton(new EditGUIButton(new ItemBuilder(Material.valueOf(displayItemData.getString("Material")), 1), new EditGUIValueString("Material", displayItemData.getString("Material")) {

        @Override
        public void setValue(Player player, String name) {
            setPathData(getKey(), name);
        }
    }));
    inv.addButton(new EditGUIButton(new ItemBuilder(Material.PAPER, 1), new EditGUIValueString("Name", displayItemData.getString("Name")) {

        @Override
        public void setValue(Player player, String name) {
            setPathData(getKey(), name);
        }
    }));
    inv.addButton(new EditGUIButton(new ItemBuilder(Material.BOOK, 1), new EditGUIValueList("Lore", displayItemData.getStringList("Lore")) {

        @Override
        public void setValue(Player player, ArrayList<String> value) {
            setPathData(getKey(), value);
        }
    }));
    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("CHEST.Shop." + identifier + ".Rewards"));
        }
    });
    // implement item reward?
    inv.openInventory(player);
}
Also used : EditGUI(com.bencodez.advancedcore.api.inventory.editgui.EditGUI) RewardEditGUI(com.bencodez.advancedcore.command.gui.RewardEditGUI) Player(org.bukkit.entity.Player) BInventoryButton(com.bencodez.advancedcore.api.inventory.BInventoryButton) ClickEvent(com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent) ArrayList(java.util.ArrayList) EditGUIValueString(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueString) EditGUIValueString(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueString) ItemBuilder(com.bencodez.advancedcore.api.item.ItemBuilder) EditGUIValueList(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueList) EditGUIValueNumber(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueNumber) EditGUIButton(com.bencodez.advancedcore.api.inventory.editgui.EditGUIButton) EditGUIValueNumber(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueNumber) ConfigurationSection(org.bukkit.configuration.ConfigurationSection)

Example 4 with EditGUIButton

use of com.bencodez.advancedcore.api.inventory.editgui.EditGUIButton 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);
}
Also used : EditGUI(com.bencodez.advancedcore.api.inventory.editgui.EditGUI) EditGUIValueBoolean(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueBoolean) Player(org.bukkit.entity.Player) EditGUIButton(com.bencodez.advancedcore.api.inventory.editgui.EditGUIButton) EditGUIValueString(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueString) EditGUIValueString(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueString)

Example 5 with EditGUIButton

use of com.bencodez.advancedcore.api.inventory.editgui.EditGUIButton 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);
}
Also used : EditGUI(com.bencodez.advancedcore.api.inventory.editgui.EditGUI) RewardEditGUI(com.bencodez.advancedcore.command.gui.RewardEditGUI) EditGUIValueBoolean(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueBoolean) Player(org.bukkit.entity.Player) BInventoryButton(com.bencodez.advancedcore.api.inventory.BInventoryButton) ClickEvent(com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent) ArrayList(java.util.ArrayList) EditGUIValueString(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueString) EditGUIValueString(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueString) ValueRequestBuilder(com.bencodez.advancedcore.api.valuerequest.ValueRequestBuilder) ItemBuilder(com.bencodez.advancedcore.api.item.ItemBuilder) NumberListener(com.bencodez.advancedcore.api.valuerequest.listeners.NumberListener) EditGUIValueList(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueList) EditGUIValueNumber(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueNumber) EditGUIButton(com.bencodez.advancedcore.api.inventory.editgui.EditGUIButton) EditGUIValueNumber(com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueNumber)

Aggregations

EditGUIButton (com.bencodez.advancedcore.api.inventory.editgui.EditGUIButton)5 Player (org.bukkit.entity.Player)5 EditGUI (com.bencodez.advancedcore.api.inventory.editgui.EditGUI)4 EditGUIValueNumber (com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueNumber)4 EditGUIValueString (com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueString)4 ItemBuilder (com.bencodez.advancedcore.api.item.ItemBuilder)4 ClickEvent (com.bencodez.advancedcore.api.inventory.BInventory.ClickEvent)3 BInventoryButton (com.bencodez.advancedcore.api.inventory.BInventoryButton)3 EditGUIValueBoolean (com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueBoolean)3 EditGUIValueList (com.bencodez.advancedcore.api.inventory.editgui.valuetypes.EditGUIValueList)3 RewardEditGUI (com.bencodez.advancedcore.command.gui.RewardEditGUI)3 ArrayList (java.util.ArrayList)3 ValueRequestBuilder (com.bencodez.advancedcore.api.valuerequest.ValueRequestBuilder)2 VoteSite (com.bencodez.votingplugin.objects.VoteSite)2 ConfigurationSection (org.bukkit.configuration.ConfigurationSection)2 JavascriptPlaceholderRequest (com.bencodez.advancedcore.api.javascript.JavascriptPlaceholderRequest)1 DirectlyDefinedReward (com.bencodez.advancedcore.api.rewards.DirectlyDefinedReward)1 Reward (com.bencodez.advancedcore.api.rewards.Reward)1 RewardEditData (com.bencodez.advancedcore.api.rewards.RewardEditData)1 RewardPlaceholderHandle (com.bencodez.advancedcore.api.rewards.RewardPlaceholderHandle)1