Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Authorises a vote
- if (command.startsWith("auth") || command.startsWith("redeem")) {
- String[] parameters = command.split("-");
- String authorisation = parameters[1];
- if (!player.getLastVoteClaim().elapsed(10000)) {
- player.write(new SendMessage("Please wait 5 seconds before trying vote again."));
- return;
- }
- Result valid;
- try {
- valid = motivote.redeem(SearchField.AUTH_CODE, authorisation);
- if (valid.success()) {
- player.getItems().addItem(20935, 1);
- player.write(new SendMessage("Authorisation code redeemed, thanks for your support."));
- player.getLastVoteClaim().reset();
- CommunityVotes.contributeVote(player);
- Result r3 = motivote.redeem(SearchField.IP_ADDRESS, player.ipAddress);
- if (r3.success()) {
- int total = r3.votes().size();
- player.write(new SendMessage(
- "We Found " + total + " Auths Linked to your IpAddress, Issuing those rewards now."));
- if (player.getItems().freeSlots() < total) {
- player.getBank().addItemToBankSky(20935, total);
- System.out.println("Player " + player.username + " just recieved Vote books x =" + total);
- for (int i = 0; i < total; i++) {
- CommunityVotes.contributeVote(player);
- }
- } else {
- player.getItems().addItem(20935, total);
- for (int i = 0; i < total; i++) {
- CommunityVotes.contributeVote(player);
- }
- }
- } else {
- player.msg("Attempted to find any other Auths connected to your IpAddress");
- player.msg("The result wasn't positive");
- }
- } else {
- player.write(new SendMessage(
- "The authorisation [" + authorisation + "] supplied was invalid, try again!"));
- player.getLastVoteClaim().reset();
- }
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
Add Comment
Please, Sign In to add comment