Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • slayerpure: custom server with goku, vegeta, darth vader, rick and morty, joker, and world boss. join now here!!!  [link]
      July 11, 2020, 08:35:27 PM
    • dan v jad: PkOwnage! 2 Worlds! Come join us!  [link]  Join us on Discord! [link]  Download Mirrors: [link]
      July 11, 2020, 10:50:02 AM
    • Shady Aftermath: Skyfire317, The Only Server With Warding,Divination,Archaeology, AFK Auto Upgrade [link]
      July 09, 2020, 12:09:03 AM
    • Shady Aftermath: Skyfire317, The Only Server With Warding,Divination,Archaeology, AFK Auto Upgrade [link]
      July 09, 2020, 12:08:59 AM
    • Shady Aftermath: Skyfire317, The Only Server With Warding,Divination,Archaeology, AFK Auto Upgrade [link]
      July 09, 2020, 12:08:51 AM
    • demon dylan: anyone know moparscape call back link?
      July 08, 2020, 07:02:51 PM
    • ragnoroker: Brand new server! Less than 1 week old! Nightmare/Raids 1/2/Hydra/Pk Modes/Exp modes/ Unique  Join today - [link]
      July 04, 2020, 06:42:38 PM
    • ragnoroker: Brand new server! Less than 1 week old! Nightmare/Raids 1/2/Hydra/Pk Modes/Exp modes/ Unique  Join today - [link]
      July 04, 2020, 06:42:32 PM
    • iddsyou: PkOwnage 2 worlds, modern OSRS & 2014 server! [link]  Join us on Discord! [link]
      July 04, 2020, 11:07:29 AM
    • slayerpure: kingdom full blown custom server with over 50 custom bosses released last week. play now here     [link]
      July 02, 2020, 08:44:32 PM
    • jgoet: dodian !!
      July 02, 2020, 07:15:44 PM
    • jgoet: join [link]  its back online !!!!
      July 02, 2020, 07:15:37 PM
    • Protojae: RIP moparscape
      July 02, 2020, 03:01:32 PM
    • Protojae: obviously thiswebsite is dead as fudge
      July 02, 2020, 03:01:14 PM
    • ragnoroker: RuneGuild has just been released! 1 Hour old, Come join the fun - [link]
      June 26, 2020, 02:14:21 PM
    • ragnoroker: RuneGuild has just been released! 1 Hour old, Come join the fun - [link]
      June 26, 2020, 02:14:08 PM
    • ragnoroker: RuneGuild has just been released! 1 Hour old, Come join the fun - [link]
      June 26, 2020, 02:14:00 PM
    • Fox2007: rune-nexus.com - FREE advertising, SEO optimized - no registration required
      June 26, 2020, 06:21:47 AM
    • Decimate Returns: trailer video posted for Project Decimate, Official Launch is in a few weeks! watch here: [youtube]LBorsdI-k1Y[/youtube]
      June 24, 2020, 07:18:03 PM
    • slayerpure: 1 week old rsps we need players and potential staff, customs and goku/vegeta sets play here!    [link] join our discord [link]
      June 24, 2020, 05:23:46 PM

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