Search in sources :

Example 1 with MessageBuilder

use of com.bencodez.advancedcore.api.messages.MessageBuilder in project VotingPlugin by Ben12345rocks.

the class VoteURL method getChat.

@Override
public ArrayList<String> getChat(CommandSender arg0) {
    ArrayList<String> sites = new ArrayList<String>();
    List<String> title = plugin.getConfigFile().getFormatCommandsVoteText();
    if (title != null) {
        sites.addAll(title);
    }
    if (plugin.getConfigFile().getFormatCommandsVoteAutoInputSites()) {
        int counter = 0;
        for (VoteSite voteSite : plugin.getVoteSites()) {
            if (!voteSite.isHidden()) {
                counter++;
                String voteURL = voteSite.getVoteURL(json);
                MessageBuilder message = new MessageBuilder(plugin.getConfigFile().getFormatCommandsVoteURLS());
                message.replacePlaceholder("num", Integer.toString(counter)).replacePlaceholder("url", voteURL).replacePlaceholder("SiteName", voteSite.getDisplayName());
                if (user != null && user.getPlayerName() != null) {
                    message.replacePlaceholder("player", "" + user.getPlayerName()).replacePlaceholder("Next", "" + user.voteCommandNextInfo(voteSite));
                }
                sites.add(message.colorize().getText());
            }
        }
    }
    if (user != null) {
        HashMap<String, String> phs = new HashMap<String, String>();
        phs.put("DailyTotal", "" + user.getTotal(TopVoter.Daily));
        phs.put("WeekTotal", "" + user.getTotal(TopVoter.Weekly));
        phs.put("MonthTotal", "" + user.getTotal(TopVoter.Monthly));
        phs.put("Total", "" + user.getTotal(TopVoter.AllTime));
        sites = ArrayUtils.getInstance().replacePlaceHolder(sites, phs);
    }
    return ArrayUtils.getInstance().colorize(sites);
}
Also used : VoteSite(com.bencodez.votingplugin.objects.VoteSite) MessageBuilder(com.bencodez.advancedcore.api.messages.MessageBuilder) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList)

Aggregations

MessageBuilder (com.bencodez.advancedcore.api.messages.MessageBuilder)1 VoteSite (com.bencodez.votingplugin.objects.VoteSite)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1