Hey guys, I'm looking for a plugin that will help drive hits to server websites, giving players a reason to go there. Here's how the plugin should work: Player types /giftme, and receives a randomly generated code, all chat disabled at this time Player goes to the website and types code into a small PHP widget (ideal for sidebars) Widget matches code to the one provided in the plugin and matches to the User that typed it Widget says "Congratulations <user>! You've won a <Item>" with a picture of the item Player clicks redeem and the item is /give'd to him Command is on configurable cooldown (displayed to user, e.g "You have 23mins 59secs before you can receive another gift") Some items can be blacklisted from the random win Even as an admin who doesn't play the game, I think this would be something I'd want to try anyway just to see what I get, and I think a lot of Servers would benefit from it. Any help appreciated Thanks guys
What format do you want the code in? Length, separators etc? It could be as long as 046b6c7f-0b8a-43b9-b35d-6489e6daee91 or perhaps as short as: 0b8a Just numeric? 7213 perhaps 674-868 And per-player codes?
I would say around 6 digits, alphanumeric preferred, something that looks like a code and would be easy to type per player is good so each player gets a random gift E.g: Your Gift Code has been Generated! Go to <URL> to redeem! Your code: 78e25g Also, to remind the users that they have a free gift waiting, when the timer reaches 0, perhaps a reminder to the player (You have 1 free gift waiting! Type /giftme to redeem!)
Could you give me the URL on which you'll be putting the widget (if you prefer I can make this configurable)?
Not to be nit-picky or anything, but could you tell me what this offers over the vanilla RCON protocol?
It's an enjin site (which doesn't allow PHP but does allow iframes), so hosted on an external webserver for me personally (or could it run on its own webserver for others?) Sorry for the late response, didn't receive any notifications
I've been working on a plugin called WebWidgets which will allow you to connect to your server through your serverIp:customPort/call?method=callingMethod&args=yourArgs (ex: localhost:25564/call?doChat&args=myName,myMessage) And then other devs are able to make addons for this but I might think about hardcoding this into it, if not I will surely create an addon for it.
Sounds good, would also hope to see Multi-Server support (a player can use the command on any server and still receive the reward)
Right, I'm not going to actually give out jars and such (due to other commitments), but I will be able to supply some code: PHP: Code generation: <?php/* Non-functional code snippet. May need modification for it to actually work *//* genCode.php -- Generates the alphanumeric code and stores it *//* Lol768 -- Gift code API for Bukkit item rewards *//* Released under GNU GPL v3 */ //Grab the config:require("config.php"); if ($cdbUser == null || $cdbPass == null || $cdbConnection == null || $dbName == null){die ("Check config.php exists");} //Variables:$characters = 'abcdefghijklmnopqrstuvwxyz0123456789'; //Lowercase letters and numbers (to avoid confusion) //Functions:function genCode($length){ $string = ''; for ($i = 0; $i < $length; $i++) { $string .= $characters[rand(0, strlen($characters) - 1)]; }} //Main code: //Ensure a username has been supplied$username = $_GET['user'];if ($username == null){ die ("Invalid supplied username");} //We've got a valid username, now it's time to connect to the DBif (!extension_loaded('pdo_mysql')){ //We don't have PDO w/ MySQL available. Damn :\ die("Sorry, I need PDO to handle database connections with MySQL");} try{ //Get a DB handle via a connection $dbh = new PDO($cdbConnection, $cdbUser, $cdbPass);}catch (PDOException $exception){ die("I couldn't connect to the DB server. Error: " . $exception->getMessage());} //Check the main table exists if ($pdo->query("SELECT codes FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = '$dbName'")->fetch()){die ("You must make a table called codes prior to attempting to use this tool");} //TODO: Cooldown (could do this in plugin code though) //get a code$code = genCode(6); // query -- $username doesn't need sanatising as this is a prepared query$sql = "INSERT INTO codes (username,code,time) VALUES (:us,:co,:now)";$q = $conn->prepare($sql);$q->execute(array(':us'=>$username, ':co'=>$code, ':now'=>microtime(true))); die("Your code is $code. Visit us to recieve your item:\nhttp://tinyurl.com/4clpsbn");?> My plan was: Write the above Use http://dev.bukkit.org/server-mods/urlmanager/ to communicate to the web based API Store a HashMap of people who've already used the command (store current system time and check it) Add some simple deletion for the redemption of the code Use a PHP RCON class (https://github.com/xPaw/PHP-Minecraft-Query) to perform a command upon redemption (e.g. give $username apple 20) Code: UrlManager um = (UrlManager) getServer().getPluginManager().getPlugin("UrlManager"); //no parameters um.addUrlCall("giftcode","http://www.example.com/genCode.php?username=test","GET");