Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • Shadow Monarch: where do i get a client and source
      November 19, 2019, 11:17:48 PM
    • Shadow Monarch: i wanna start a server
      November 19, 2019, 11:17:34 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure : [link]
      November 19, 2019, 12:52:54 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure : [link]
      November 19, 2019, 12:52:50 PM
    • U Go Home: hey does anyone have allstarscape v2 i want to make it better something to do and try and bring back the good old days
      November 19, 2019, 09:22:14 AM
    • ArtexAdv:[link] come check out the most
      November 18, 2019, 11:39:14 AM
    • ArtexAdv: Www.galaxy-rsps.net come check out the most unique custom rsps
      November 18, 2019, 11:38:50 AM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure : [link]
      November 17, 2019, 10:14:59 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure : [link]
      November 17, 2019, 10:14:50 PM
    • Mazeingmaze: last logged in 2008
      November 17, 2019, 06:46:52 PM
    • Mazeingmaze: Ayy BRO
      November 17, 2019, 06:46:46 PM
    • SuperNativeZ: WANT TO BE APART OF THE BEST RSPS? [link]
      November 17, 2019, 12:22:53 AM
    • SuperNativeZ: WHY CHOOSE GALAXY RSPS?  WE HAVE THE BEST UNIQUE GAMEPLAY [link]
      November 17, 2019, 12:22:42 AM
    • SuperNativeZ: WHY CHOOSE GALAXY RSPS?  WE HAVE THE BEST UNIQUE GAMEPLAY [link]
      November 17, 2019, 12:22:39 AM
    • ragnoroker: Brand new server, come join the fun - unique server - RuneGuild -[link]
      November 15, 2019, 12:46:05 PM
    • ragnoroker: Brand new server, come join the fun - unique server - RuneGuild -[link]
      November 15, 2019, 12:46:01 PM
    • Cole1497: join horney scape we are horney all the time and have a sex emote
      November 09, 2019, 05:14:33 PM
    • thewraith500: try autoscape,0rg brand new osrs CUSTOMS server! fight caves for flaming fire cape, upgrade them to infernal wings + more!
      November 09, 2019, 01:37:29 AM
    • SuperNativeZ: Come play brand new server [link]
      November 08, 2019, 02:13:24 PM
    • SuperNativeZ: Come play brand new server [link]
      November 08, 2019, 02:13:17 PM

    Author Topic: MotivoteRS Installation Tutorial [ANY BASE] (vote auth system)  (Read 3150 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

    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.
    .

    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