Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • AutoScapeM: Join autoscape,0rg fun events daily for infernal mystery boxes only server with Infernal Twisted Bow
      September 19, 2019, 11:57:33 PM
    • AutoScapeM: Join autoscape,0rg fun events daily for infernal mystery boxes only server with Infernal Twisted Bow
      September 19, 2019, 11:57:30 PM
    • AutoScapeM: Join autoscape,0rg fun events daily for infernal mystery boxes only server with Infernal Twisted Bow
      September 19, 2019, 11:57:25 PM
    • AutoScapeM: Join autoscape,0rg fun events daily for infernal mystery boxes only server with Infernal Twisted Bow
      September 19, 2019, 11:57:19 PM
    • PavSwag: try autoscape,0rg today i will personally help you get RICH and well KNOWN - pav
      September 19, 2019, 12:36:06 PM
    • PavSwag: try autoscape,0rg today i will personally help you get RICH and well KNOWN - pav
      September 19, 2019, 12:35:49 PM
    • Codar: Come join us while we're fresh we're growing fast!! @ [link]
      September 18, 2019, 09:30:25 PM
    • Codar: New RSPS come check us out! @ [link]
      September 18, 2019, 04:07:24 AM
    • Codar: Released a new server come check us out! @ [link]
      September 18, 2019, 02:08:23 AM
    • ragnoroker: RuneGuild will be hosting some tournaments later to win some mystery boxes, join here : [link]
      September 16, 2019, 09:50:10 AM
    • calemx: death's-server has officially been released, come check us out  - [link]
      September 13, 2019, 04:14:21 AM
    • PavSwag: try autoscape,0rg today i will personally help you get RICH and well KNOWN - pav
      September 12, 2019, 12:26:40 PM
    • cbrophy: would my account from 2013 work?
      September 12, 2019, 05:04:43 AM
    • ragnoroker: RuneGuild has officially been released, come check us out - [link]
      September 11, 2019, 11:26:35 AM
    • ragnoroker: RuneGuild has officially been released, come check us out - [link]
      September 11, 2019, 11:26:31 AM
    • ragnoroker: RuneGuild is due to be released tomorrow! First few players will recieve some goodies. Sign up on our website [link] Join our discord for updates [link]
      September 07, 2019, 07:43:28 PM
    • ragnoroker: RuneGuild is due to be released tomorrow! First few players will recieve some goodies. Sign up on our website [link] Join our discord for updates [link]
      September 07, 2019, 07:42:59 PM
    • ChrisMeadows: Yo, what's the forum's discord?
      September 04, 2019, 08:33:06 PM
    • newerarsps: i cannot register to rsps list anyone can help?
      September 01, 2019, 11:24:00 PM
    • PavSwag: Date Registered: July 03, 2012, 03:54:45 PM Think im just as good vet as u man, + I have over 80B in rs3 think im good on anyones 100k ass lookin bank b oi
      August 27, 2019, 10:48:09 AM

    Author Topic: MotivoteRS Installation Tutorial [ANY BASE] (vote auth system)  (Read 3105 times)

    0 Members and 1 Guest are viewing this topic.

    OfflineSupah Flyizzle

    • Member
    • **
    • Posts: 50
    • Thanks: +0/-0
      • View Profile


    The GTLVote project has been discontinued, and this project is the recommended replacement.

    Motivote Installation Tutorial
    In order to install Motivote, you must download it[/URL] and include it in your classpath. Click here[/URL] if you use Eclipse otherwise, click here[/URL]. Motivote requires logging into to manage services, so you must set that up before continuing.

    Project Insanity Bases
    Browse to "./src/server/model/players/packets/Commands.java". Add the following to the very top of that file.

    Code: [Select]
    import com.motivoters.motivote.service.MotivoteRS;
    Inside of the class, add this next variable!

    In order for Motivote to function, it needs to know who you are and it needs to know a secret about you to know you are who you are. Replace the things that are in quotes with what they should be.

    Replace example with your Motivote service's subdomain, and api_key with your API key.

    Code: [Select]
    private final MotivoteRS motivote = new MotivoteRS("example", "api_key");
    Now we search for the "playerCommands" method. Below is an example of checking an auth.

    Code: [Select]
    if (playerCommand.startswith("redeem")) {
    String auth = playerCommand.replace("redeem ", "");

    try {
    boolean success = motivote.redeemVote(auth);

    if (success) {
    c.getItems().addItem(995, 10000);
    c.sendMessage("Auth redeemed, thanks for voting!");
    }
    else {
    c.sendMessage("Invalid auth supplied, please try again later.");
    }
    }
    catch (Exception ex) {
    ex.printStackTrace();
    c.sendMessage("Unable to check auth, please try again later.");
    }
    }

    That's it. Optionally, I'd suggest moving this to execute on a separate single threaded executor and then submit a task to add the rewards (points, items, etc.)


    Let me know if you have any questions.
    .
    Runescape Gambling

    OfflineD3i7y

    • Member
    • ***
    • Posts: 173
    • Thanks: +0/-0
      • View Profile
    Re: MotivoteRS Installation Tutorial [ANY BASE] (vote auth system)
    « Reply #1 on: April 16, 2016, 10:05:07 AM »
    Since no one else is posting i decided to try this out in a development environment it actually coverts fairly easy to my unique project. i think you should make the site throw errors when you miss type a code for the server though it was annoying the hell out of me because i needed a test environment but the tutorial didn't cover the home_url i thought it meant something else so after i got annoyed came back and tried again it was something very simple. but it wasn't explained well.

    I'm glad you started a replacement for the previous vote setup. We plan on setting up our own voting page but for now i will use this because our web developer is a slacker.. ;3

    Thanks
    Runescape Gambling

    OfflineSupah Flyizzle

    • Member
    • **
    • Posts: 50
    • Thanks: +0/-0
      • View Profile
    Re: MotivoteRS Installation Tutorial [ANY BASE] (vote auth system)
    « Reply #2 on: April 16, 2016, 03:47:19 PM »
    I just looked through the source code on GitHub, you should be handling exceptions not doing:
    Code: Java
    1. try{
    2.     ...
    3. }catch(Exception ex){
    4.     ex.printStackTrace();
    5. }


    Also could do a little changes here and there :P

    I don't think those exceptions are relevant to the returned value of the method. Printing out the error is a valid course of action for the error.


    Also, thank you guys for your responses. I will provide more explanation for each of these variables on the page in the near future.
    .
    Runescape Gambling

    OfflineSupah Flyizzle

    • Member
    • **
    • Posts: 50
    • Thanks: +0/-0
      • View Profile
    Re: MotivoteRS Installation Tutorial [ANY BASE] (vote auth system)
    « Reply #3 on: April 17, 2016, 10:55:08 PM »
    I just looked through the source code on GitHub, you should be handling exceptions not doing:
    Code: Java
    1. try{
    2.     ...
    3. }catch(Exception ex){
    4.     ex.printStackTrace();
    5. }


    Also could do a little changes here and there :P

    I don't think those exceptions are relevant to the returned value of the method. Printing out the error is a valid course of action for the error.


    Also, thank you guys for your responses. I will provide more explanation for each of these variables on the page in the near future.
    I really frown upon just throwing general exceptions and just printstacktrace is considered bad practise. Meaningful exceptions would be nice especially if you're making an api. It also shouldn't be visible to the end user.

    Don't take me to heart though, I'm just ranting over something the rsps community probably doesn't care about :p

    Yeah, I get what you mean. I think that this is intended for beginner level programmers and idk if you've ever done work for random people on the internet but there are some clueless kids out there, so throwing a wrench at them when they don't give a shit won't really help anyone get anything meaningful done.


    Whatever I write for RSPS tends to stay true to that because I'm developing for people, not developers. This is a weird niche where people want to program but if they can get by on the minimum, they will. People just want to do the bare minimum. It's open sourced and there's more info available for people that care but for the non-developer it's really easy to understand.
    « Last Edit: April 17, 2016, 11:02:53 PM by Supah Flyizzle »
    .

     

    Copyright © 2017 MoparScape. All rights reserved.
    Powered by SMFPacks SEO Pro Mod |
    SimplePortal 2.3.5 © 2008-2012, SimplePortal