Voting Setup & Made SettingsLoader a tiny bit cleaner (#53)

This commit is contained in:
Josh Shippam
2019-10-12 20:58:55 +01:00
committed by Daniel Ginovker
parent fc45ec3548
commit 6cfca2886a
5 changed files with 45 additions and 12 deletions
@@ -44,6 +44,36 @@ public class Commands implements PacketType {
player.getPlayerAssistant().openUpBank();
}
if (playerCommand.startsWith("claimvote")) {
if(!Server.ersSecret.equals("")) {
final String playerName = player.playerName;
com.everythingrs.vote.Vote.service.execute(new Runnable() {
@Override
public void run() {
try {
int currentPoints = player.votePoints;
com.everythingrs.vote.Vote[] reward = com.everythingrs.vote.Vote.reward(Server.ersSecret, playerName, "1", "all");
if (reward[0].message != null) {
player.getActionSender().sendMessage(reward[0].message);
return;
}
player.votePoints = (currentPoints + reward[0].give_amount);
//player.getActionSender().sendMessage("Thank you for voting! You now have " + reward[0].vote_points + " vote points.");
player.getActionSender().sendMessage(
"Thank you for voting! You now have " + player.votePoints + " vote points.");
} catch (Exception e) {
player.getActionSender().sendMessage("Api Services are currently offline. Please check back shortly");
e.printStackTrace();
}
}
});
} else {
player.getActionSender().sendMessage("Voting Is Not Enabled");
}
}
if (playerCommand.equalsIgnoreCase("coords") || playerCommand.equalsIgnoreCase("coord") || playerCommand.equalsIgnoreCase("pos")){
player.getActionSender().sendMessage("Your coords are [" + player.absX + "," + player.absY + "]");
}