Jump to content
Sign in to follow this  
Tater Pie

Incentive Review System

Recommended Posts

INTRODUCING: The Incentive Review System

I've written a complete system securely for you to add incentive review system for our community into your servers easily!

Here is the code to send an HTTP GET request in java to get a boolean value whether or not the player has voted or not.

 

Anyone who needs help with this pm me on here or on discord Tater Pie#9858 I will help you set this up if you want to add it. 

Reasons to use our service over everything-rs or other toplists:

  • We don't have a large API or external library you have to add to your server.. Its stored in the forum database with everyones account information for the forums in a reviews table.
  • Our system ELIMINATES  spam voting. We guarantee your reviews to be authentic and you have the choice to remove negative ads with admin approval. 
  • The php script I have provided is 10 lines or so and simply queries the database to check for a review under a certain thread ID, and returns true or false depending on the result.
  • We provide real time server status optional to the AD creator
  • Banners, titles and server statuses are beautifully displayed within the tables much like a forum threads, but with much more modern features.

Cons:

  • Your players will have to register here for their review to be counted by our system. This ensures that all possible measures are taken to keep your reviews authentic.

UPDATE: 4/20/2019 3:11PM: I've just added a feature when you create an ad in the toplist it shows whether or not the server is online, optional to the person creating the ad

UPDATE: I just realized the database categorizes all reviews together so the thread id needs to be specified for your ad... If you want to add incentive voting to your server then just pm me and i will look up your ad's thread ID and you can just edit the code below to match

 

package org.server.util;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class GETUtil {

	//the base URL string for all vote requests 
	public static final String BASE_URL = "https://rsps-community.com/votec.php?nc=";
	public static final int myThreadId = 3;// this is kais thread id you should replace this with your id

    public static boolean checkReview(String name) throws Exception { 
        // instantiate the URL string as an object that we can use to open a connection
        URL myurl = new URL(BASE_URL + name + "&id=" + myThreadId);
        //open the connection to the url
        HttpURLConnection con = (HttpURLConnection) myurl.openConnection();
        //set the request method to be an HTTP GET request
        con.setRequestMethod("GET");
        //instantiate the response, set it to false
        boolean response = false;
        //try and open a buffered reader from the connections input stream
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            //read the response as a string and then parse it into a boolean value
            response = Boolean.parseBoolean(in.readLine()); 

        //*finally* we close the connection if it was created
        } finally {
            if(con != null)
            	con.disconnect();
        } 
        //return the response whether it was changed or not
        return response;
    }
}

 

I suggest implementing it like so:

if(playerCommand.equalsIgnoreCase("reward")) {
	if(player.voted) {
		player.getPacketSender().sendMessage("You can only claim the reward or vote once, sorry.");
		return;
	}

    //in your command tell your players to replace any spaces
    //in their forum name with underscores in their command
    //usage: ::reward forum_name, example: ::reward tater_pie
    String command = "reward tater_pie".replaceAll("_", "%20");

    //this way we can use regular expression to grab the name
    //without splitting the name up if it contains spaces
    String name = command.split(" ")[1];

	//finally call the method
    boolean response = GETUtil.checkReview(name);
	//if response is true which only happens if the user has voted - tested extensively
	if(response) {
		//add 2 million coins to the players inventory
		player.getInventory().addItem(995, 2000000);
	}
	
    //player.setForumName(name);//optional, i would log this in my server
	//make sure you save or serialize this somehow into your player files  
    player.voted = true; 
}

 

  • Thanks 1

Share this post


Link to post
Share on other sites
2 hours ago, Nes said:

Awesome!

I updated the thread, there was a small bug but its fixed now, if would like to add this to your server just send me a PM cuz you need the thread ID for your ad 🙂

Share this post


Link to post
Share on other sites
23 hours ago, Dexter said:

Now this is truly amazing, Keep up the good work @Tater Pie.

Thanks man I'm trying to get more server owners using it, which will increase the flow of traffic on our forums as a result, and encourage people to learn to code, gfx, make models etc whatever sparks their interest

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using our forums or services as a guest you agree to our Terms of Service: Terms of Use Privacy Policy: Privacy Policy and Guidelines