Thread: [Vencillio] Vote command

Results 1 to 7 of 7
  1. #1 [Vencillio] Vote command 
    Registered Member
    Join Date
    May 2017
    Posts
    145
    Thanks given
    57
    Thanks received
    47
    Rep Power
    31
    Hello All,

    I'm trying to add Motivote to my server but I'm having trouble adding it. Here is the command I currently have.

    Spoiler for Open Command:

    Code:
    case "redeem":
    			   String auth = parser.nextString().replaceAll("redeem ", "");
    			    
    			    try {
    			     boolean success = MOTIVOTE.redeem(auth);
    			     
    			     if (success) {
    			      Constants.LAST_VOTER = player.getUsername();
    			      Constants.CURRENT_VOTES++;
    			                                  player.setVotePoints(player.getVotePoints() + 1);
    			      World.sendGlobalMessage("<img=8> @red@" + Utility.formatPlayerName(player.getUsername()) + " has just claimed an auth code");
    			      player.send(new SendMessage("Thank you for voting, " + Utility.formatPlayerName(player.getUsername()) + "!"));
    			     }
    			     else {
    			      player.send(new SendMessage("Invalid auth!"));
    			     }
    			    }
    			    catch (Exception ex) {
    			     ex.printStackTrace();
    			    }
    			   return true;


    This is the error in Eclipse:

    Attached image

    Everything is fine, except for that part.

    Keep in mind that this is the latest Motivote system so I don't know what's wrong.

    Other useful info:

    Attached image

    Any help is appreciated!

    Note: I have tried searching for what other people are using and none of them have helped..
    Reply With Quote  
     

  2. #2  
    Blurite

    Corey's Avatar
    Join Date
    Feb 2012
    Age
    26
    Posts
    1,491
    Thanks given
    1,245
    Thanks received
    1,729
    Rep Power
    5000
    Hover over the underline and tell us what the error is
    Attached image
    Reply With Quote  
     

  3. #3  
    What's a sundial in the shade?

    Lumiere's Avatar
    Join Date
    May 2013
    Age
    27
    Posts
    543
    Thanks given
    224
    Thanks received
    100
    Rep Power
    113
    Hovering over it may also show you suggestions for the correct method to be called.
    EDIT: Unsure if it will with a jar, but yeah.

    Spoiler for Revy is perfect:
    Reply With Quote  
     

  4. #4  
    08-13, SpawnScape Owner

    jet kai's Avatar
    Join Date
    Dec 2009
    Age
    28
    Posts
    870
    Thanks given
    630
    Thanks received
    957
    Rep Power
    5000
    Requires either:

    Code:
    MOTIVOTE.redeem(SearchField.AUTH_CODE, auth);
    MOTIVOTE.redeem(SearchField.USER_NAME, username);
    MOTIVOTE.redeem(SearchField.IP_ADDRESS, ip);
    not

    Code:
    MOTIVOTE.redeem(auth);
    Source:

    the monti website /info/getting-started
    Reply With Quote  
     

  5. Thankful user:


  6. #5  
    Registered Member
    Join Date
    May 2017
    Posts
    145
    Thanks given
    57
    Thanks received
    47
    Rep Power
    31
    Quote Originally Posted by jet kai View Post
    Requires either:

    Code:
    MOTIVOTE.redeem(SearchField.AUTH_CODE, auth);
    MOTIVOTE.redeem(SearchField.USER_NAME, username);
    MOTIVOTE.redeem(SearchField.IP_ADDRESS, ip);
    not

    Code:
    MOTIVOTE.redeem(auth);
    Source:

    the monti website /info/getting-started
    Hi thanks for the informative response. It fixed the error but I had to change the boolean to this:

    Attached image

    Would you say that is correct with " != null;" at the end?
    Reply With Quote  
     

  7. #6  
    What's a sundial in the shade?

    Lumiere's Avatar
    Join Date
    May 2013
    Age
    27
    Posts
    543
    Thanks given
    224
    Thanks received
    100
    Rep Power
    113
    Quote Originally Posted by ThaAj View Post
    Hi thanks for the informative response. It fixed the error but I had to change the boolean to this:

    Attached image

    Would you say that is correct with " != null;" at the end?
    That will work because "MOTIVOTE.redeem(SearchField.AUTH_CODE, auth) != null" is true or false, so the boolean success will rely on whether it's null.
    However, I'm unfamiliar with Motivote, but I would assume that method is a boolean itself.
    Either that, or it's returning a value of some sort as way to make sure it passes.

    So, with that being said, if that IS the case, you should probably also check if its true.
    So an easier way would be to remove the != null (if it is a boolean method), then just do;
    "if (success != null && success)"

    You should also make that boolean final, as there's no reason for the value to be changed after assigning it.

    EDIT: Also.. "Constants.LAST_VOTER", "Constants.CURRENT_VOTES" <- these are not constants

    Spoiler for Revy is perfect:
    Reply With Quote  
     

  8. Thankful user:


  9. #7  
    Registered Member
    Join Date
    May 2017
    Posts
    145
    Thanks given
    57
    Thanks received
    47
    Rep Power
    31
    Quote Originally Posted by Lumiere View Post
    That will work because "MOTIVOTE.redeem(SearchField.AUTH_CODE, auth) != null" is true or false, so the boolean success will rely on whether it's null.
    However, I'm unfamiliar with Motivote, but I would assume that method is a boolean itself.
    Either that, or it's returning a value of some sort as way to make sure it passes.

    So, with that being said, if that IS the case, you should probably also check if its true.
    So an easier way would be to remove the != null (if it is a boolean method), then just do;
    "if (success != null && success)"

    You should also make that boolean final, as there's no reason for the value to be changed after assigning it.

    EDIT: Also.. "Constants.LAST_VOTER", "Constants.CURRENT_VOTES" <- these are not constants
    It worked! Thanks for the info!
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Vencillio Voting Command
    By awesomenoob in forum Help
    Replies: 2
    Last Post: 12-01-2016, 12:09 AM
  2. ::vote command problems
    By Ninja assassin in forum Help
    Replies: 7
    Last Post: 09-16-2010, 10:27 PM
  3. PI ::vote command?
    By echomatic in forum Help
    Replies: 12
    Last Post: 08-11-2010, 10:14 AM
  4. Adding a ::vote command Rep++
    By Chris123111 in forum Help
    Replies: 8
    Last Post: 08-01-2010, 12:45 AM
  5. vote command
    By Bondie8 in forum Help
    Replies: 1
    Last Post: 04-13-2010, 12:52 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •