Search in sources :

Example 1 with SimpleScoreboard

use of com.Ben12345rocks.AdvancedCore.Util.Scoreboards.SimpleScoreboard in project VotingPlugin by Ben12345rocks.

the class Commands method sendTopVoterAllTimeScoreBoard.

/**
 * Send top voter monthly score board.
 *
 * @param player
 *            the player
 * @param page
 *            the page
 */
public void sendTopVoterAllTimeScoreBoard(Player player, int page) {
    if (AdvancedCoreHook.getInstance().isSendScoreboards()) {
        int pagesize = Config.getInstance().getFormatPageSize();
        ArrayList<User> users = plugin.convertSet(plugin.topVoterAllTime.keySet());
        int pageSize = (users.size() / pagesize);
        if ((users.size() % pagesize) != 0) {
            pageSize++;
        }
        String title = StringUtils.getInstance().colorize(config.getFormatCommandVoteTopTitle().replace("%page%", "" + page).replace("%maxpages%", "" + pageSize).replace("%Top%", "All"));
        SimpleScoreboard scoreboard = new SimpleScoreboard(title);
        for (int i = (page - 1) * pagesize; (i < users.size()) && (i < (((page - 1) * pagesize) + 10)); i++) {
            scoreboard.add("" + (i + 1) + ": " + users.get(i).getPlayerName(), plugin.topVoterAllTime.get(users.get(i)));
        }
        scoreboard.build();
        scoreboard.send(player);
        Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {

            @Override
            public void run() {
                SimpleScoreboard clear = new SimpleScoreboard("Empty");
                clear.send(player);
            }
        }, 90);
    }
}
Also used : User(com.Ben12345rocks.VotingPlugin.Objects.User) SimpleScoreboard(com.Ben12345rocks.AdvancedCore.Util.Scoreboards.SimpleScoreboard)

Example 2 with SimpleScoreboard

use of com.Ben12345rocks.AdvancedCore.Util.Scoreboards.SimpleScoreboard in project VotingPlugin by Ben12345rocks.

the class Commands method sendTopVoterWeeklyScoreBoard.

/**
 * Send top voter weekly score board.
 *
 * @param player
 *            the player
 * @param page
 *            the page
 */
public void sendTopVoterWeeklyScoreBoard(Player player, int page) {
    if (AdvancedCoreHook.getInstance().isSendScoreboards()) {
        int pagesize = Config.getInstance().getFormatPageSize();
        ArrayList<User> users = plugin.convertSet(plugin.topVoterWeekly.keySet());
        int pageSize = (users.size() / pagesize);
        if ((users.size() % pagesize) != 0) {
            pageSize++;
        }
        String title = StringUtils.getInstance().colorize(config.getFormatCommandVoteTopTitle().replace("%page%", "" + page).replace("%maxpages%", "" + pageSize).replace("%Top%", "Weekly"));
        SimpleScoreboard scoreboard = new SimpleScoreboard(title);
        for (int i = (page - 1) * pagesize; (i < users.size()) && (i < (((page - 1) * pagesize) + 10)); i++) {
            scoreboard.add("" + (i + 1) + ": " + users.get(i).getPlayerName(), plugin.topVoterWeekly.get(users.get(i)));
        }
        scoreboard.build();
        scoreboard.send(player);
        Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {

            @Override
            public void run() {
                SimpleScoreboard clear = new SimpleScoreboard("Empty");
                clear.send(player);
            }
        }, 90);
    }
}
Also used : User(com.Ben12345rocks.VotingPlugin.Objects.User) SimpleScoreboard(com.Ben12345rocks.AdvancedCore.Util.Scoreboards.SimpleScoreboard)

Example 3 with SimpleScoreboard

use of com.Ben12345rocks.AdvancedCore.Util.Scoreboards.SimpleScoreboard in project VotingPlugin by Ben12345rocks.

the class Commands method sendVoteTodayScoreBoard.

/**
 * Send vote today score board.
 *
 * @param player
 *            the player
 * @param page
 *            the page
 */
public void sendVoteTodayScoreBoard(Player player, int page) {
    if (AdvancedCoreHook.getInstance().isSendScoreboards()) {
        int pagesize = Config.getInstance().getFormatPageSize();
        String[] voteToday = voteToday();
        int maxPage = voteToday.length / pagesize;
        if ((voteToday.length % pagesize) != 0) {
            maxPage++;
        }
        SimpleScoreboard scoreboard = new SimpleScoreboard("&cToday's Votes " + page + "/" + maxPage);
        for (int i = pagesize * page; (i < voteToday.length) && (i < ((page + 1) * pagesize)); i++) {
            scoreboard.add(voteToday[i], i);
        }
        scoreboard.build();
        scoreboard.send(player);
        Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {

            @Override
            public void run() {
                SimpleScoreboard clear = new SimpleScoreboard("Empty");
                clear.send(player);
            }
        }, 90);
    }
}
Also used : SimpleScoreboard(com.Ben12345rocks.AdvancedCore.Util.Scoreboards.SimpleScoreboard)

Example 4 with SimpleScoreboard

use of com.Ben12345rocks.AdvancedCore.Util.Scoreboards.SimpleScoreboard in project VotingPlugin by Ben12345rocks.

the class Commands method sendTopVoterDailyScoreBoard.

/**
 * Send top voter daily score board.
 *
 * @param player
 *            the player
 * @param page
 *            the page
 */
public void sendTopVoterDailyScoreBoard(Player player, int page) {
    if (AdvancedCoreHook.getInstance().isSendScoreboards()) {
        int pagesize = Config.getInstance().getFormatPageSize();
        ArrayList<User> users = plugin.convertSet(plugin.topVoterDaily.keySet());
        int pageSize = (users.size() / pagesize);
        if ((users.size() % pagesize) != 0) {
            pageSize++;
        }
        String title = StringUtils.getInstance().colorize(config.getFormatCommandVoteTopTitle().replace("%page%", "" + page).replace("%maxpages%", "" + pageSize).replace("%Top%", "Daily"));
        SimpleScoreboard scoreboard = new SimpleScoreboard(title);
        for (int i = (page - 1) * pagesize; (i < users.size()) && (i < (((page - 1) * pagesize) + 10)); i++) {
            scoreboard.add("" + (i + 1) + ": " + users.get(i).getPlayerName(), plugin.topVoterDaily.get(users.get(i)));
        }
        scoreboard.build();
        scoreboard.send(player);
        Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {

            @Override
            public void run() {
                SimpleScoreboard clear = new SimpleScoreboard("Empty");
                clear.send(player);
            }
        }, 90);
    }
}
Also used : User(com.Ben12345rocks.VotingPlugin.Objects.User) SimpleScoreboard(com.Ben12345rocks.AdvancedCore.Util.Scoreboards.SimpleScoreboard)

Example 5 with SimpleScoreboard

use of com.Ben12345rocks.AdvancedCore.Util.Scoreboards.SimpleScoreboard in project VotingPlugin by Ben12345rocks.

the class Commands method sendTopVoterMonthlyScoreBoard.

/**
 * Send top voter monthly score board.
 *
 * @param player
 *            the player
 * @param page
 *            the page
 */
public void sendTopVoterMonthlyScoreBoard(Player player, int page) {
    if (AdvancedCoreHook.getInstance().isSendScoreboards()) {
        int pagesize = Config.getInstance().getFormatPageSize();
        ArrayList<User> users = plugin.convertSet(plugin.topVoterMonthly.keySet());
        int pageSize = (users.size() / pagesize);
        if ((users.size() % pagesize) != 0) {
            pageSize++;
        }
        String title = StringUtils.getInstance().colorize(config.getFormatCommandVoteTopTitle().replace("%page%", "" + page).replace("%maxpages%", "" + pageSize).replace("%Top%", "Monthly"));
        SimpleScoreboard scoreboard = new SimpleScoreboard(title);
        for (int i = (page - 1) * pagesize; (i < users.size()) && (i < (((page - 1) * pagesize) + 10)); i++) {
            scoreboard.add("" + (i + 1) + ": " + users.get(i).getPlayerName(), plugin.topVoterMonthly.get(users.get(i)));
        }
        scoreboard.build();
        scoreboard.send(player);
        Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {

            @Override
            public void run() {
                SimpleScoreboard clear = new SimpleScoreboard("Empty");
                clear.send(player);
            }
        }, 90);
    }
}
Also used : User(com.Ben12345rocks.VotingPlugin.Objects.User) SimpleScoreboard(com.Ben12345rocks.AdvancedCore.Util.Scoreboards.SimpleScoreboard)

Aggregations

SimpleScoreboard (com.Ben12345rocks.AdvancedCore.Util.Scoreboards.SimpleScoreboard)5 User (com.Ben12345rocks.VotingPlugin.Objects.User)4