Skip to content

Commit

Permalink
Add player placeholder to vote reminder broadcast for voteparty
Browse files Browse the repository at this point in the history
  • Loading branch information
BenCodez committed Oct 13, 2023
1 parent 2433005 commit 16cdfec
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,17 +344,19 @@ public void setVotedUsers(ArrayList<String> value) {
plugin.getServerData().saveData();
}

public void checkVoteReminder() {
public void checkVoteReminder(VotingPluginUser user) {
int neededVotes = getNeededVotes();

for (String str : plugin.getSpecialRewardsConfig().getVotePartyVoteReminderAtVotes()) {
if (StringParser.getInstance().isInt(str)) {
int num = Integer.parseInt(str);
if (neededVotes == num) {
String broadcastMessage = plugin.getSpecialRewardsConfig().getVotePartyVoteReminderBroadcast();
broadcastMessage = StringParser.getInstance().replacePlaceHolder(broadcastMessage, "votesrequired",
"" + neededVotes);
MiscUtils.getInstance().broadcast(broadcastMessage);
HashMap<String, String> placeholders = new HashMap<String, String>();
placeholders.put("player", user.getPlayerName());
placeholders.put("votesrequired", "" + neededVotes);
MiscUtils.getInstance()
.broadcast(StringParser.getInstance().replacePlaceHolder(broadcastMessage, placeholders));
}
}
}
Expand All @@ -367,7 +369,7 @@ public synchronized void vote(VotingPluginUser user, boolean realVote, boolean f
addTotal(user);
addVotePlayer(user);
check(user, forceBungee);
checkVoteReminder();
checkVoteReminder(user);
}
}
}
Expand Down

0 comments on commit 16cdfec

Please sign in to comment.