stuff
This commit is contained in:
32
src/main/java/cc/fascinated/vote/VoteManager.java
Normal file
32
src/main/java/cc/fascinated/vote/VoteManager.java
Normal file
@ -0,0 +1,32 @@
|
||||
package cc.fascinated.vote;
|
||||
|
||||
import cc.fascinated.account.Account;
|
||||
import cc.fascinated.command.CommandManager;
|
||||
import cc.fascinated.config.Lang;
|
||||
import cc.fascinated.playercolor.PlayerColorProfile;
|
||||
import cc.fascinated.utils.Manager;
|
||||
import cc.fascinated.utils.MessageUtils;
|
||||
import cc.fascinated.vote.command.VoteStatsCommand;
|
||||
import com.vexsoftware.votifier.model.VotifierEvent;
|
||||
|
||||
public class VoteManager extends Manager {
|
||||
|
||||
public VoteManager() {
|
||||
CommandManager.registerCommand(new VoteStatsCommand());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVote(Account account, VotifierEvent event) {
|
||||
VoteProfile voteProfile = account.getVoteProfile();
|
||||
PlayerColorProfile playerColorProfile = account.getPlayerColorProfile();
|
||||
voteProfile.addVote(); // Add the vote to the player's profile
|
||||
|
||||
MessageUtils.broadcast(Lang.VOTE_BROADCAST.getAsString()
|
||||
.replace("%player%", account.getPlayer().getName())
|
||||
.replace("player-color", playerColorProfile.getColor().toString())
|
||||
);
|
||||
account.sendMessage(Lang.VOTE_VOTED.getAsString()
|
||||
.replace("%votes%", voteProfile.getTotalVotes() + "")
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user