CodeChecker

1.9k Downloads

Have you ever wanted to be able to have trusted users, but not let them abuse their abilities? Have you ever wanted to be able to money off of your server, without having to be online all the time to apply the perks. Well, then, this is the plugin for you! You can use this for anything! Want to be able to let someone use a command only a couple of times? Go for it! Want to get revenue from one-time commands? Go for it!

What exactly IS this plugin? You can add redeemable codes online (I will explain this later), or in game! You can even make it automated, as it's connected to a database, which can be easily modified anywhere, anytime!

Current Features:

  • Add Codes In-Game
  • Add Codes Online
  • Item Spawning
  • Time Changing
  • Teleport's
  • Op

USAGE: To generate a code ingame:

  • /cg <type: 0 for op, 1 for one-time-tp, 2 for one-time time change, 3 for one-time item spawning>

To use a code:

  • /code <code> <params: for one-time-tp, enter in the username; for time change, enter in the requested time; for item spawning, type in the item ID>

Online Usage: DISCLAIMER: I have NOT tested this code! I take NO responsibility for anything that happens while using this code!

HTML Form:

<form name="input" action="add.php" method="POST">
Type (0 for OP, 1 for one-time TP, 2 for time, 3 for item-spawning): <input type="text" name="type" />
<input type="submit" value="Submit" />
</form>

PHP Script: NOTE: Please replace the "REPLACE" values with the appropriate values!

<?php
$host = "REPLACE";
$user = "REPLACE";
$pass = "REPLACE";
$databaseName = "REPLACE";
$tableName = "REPLACE";

if($_POST['type'] != 0)
{
 if($_POST['type'] != 1)
 {
  if($_POST['type'] != 2)
  {
   if($_POST['type'] != 3)
   {
    die("Invalid type!");
   }
  }
 }
}
$type = $_POST['type'];
$random= "";
$length = 8;
  srand((double)microtime()*1000000);
  $char_list = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  $char_list .= "abcdefghijklmnopqrstuvwxyz";
  $char_list .= "123456789";
  // Add the special characters to $char_list if needed

  for($i = 0; $i < $length; $i++)  
  {    
     $random .= substr($char_list,(rand()%(strlen($char_list))), 1);  
  }  
$link = mysql_connect($host, $user, $pass);
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
mysql_select_db($databaseName, $link); 
$result = mysql_query("INSERT INTO '$tableName' (code, type) VALUES ('$random', '$type')");
if($result)
{
  echo "Your code for type ".$type." is ".$random;
}
else
{
  echo "ERROR!";
}
mysql_close($link);

?>

Available Perks and Corresponding Types:

  • OP / 0
  • One-Time Teleport / 1
  • One-Time Change the Time / 2
  • One-Time Item Spawn /3

I am going to be adding a lot more features very soon. If you have any suggestions, be sure to PM me!

Here is how your database should look like:

  • Database Name (What you put in the YML file)
  • Table Name (What you put in the YML file)
  • codes (Varchar 8 Characters)
  • type (Varchar or Int 1 Character)

Here is how you should format the YML file: Table Name: tablename

Database Name: databasename

Database Host: databasehost

Database Username: databaseusername

Database Password: databasepassword http://dev.bukkit.org/server-mods/codechecker/pages/main/edit/ A special thanks to ShiftTH (ShiftedPerspective on Bukkit) and warmaster4 for helping me test this plugin!

Changelog:

Version 0.1:

  • Initial Release

Version 0.2:

  • Added support for item spawning

PayPal IPN Instructions:

There is a link to the IPN scripts on the bottom.

To make a button, do the following:

Go to "Merchant Services" and click on "Buy Now" under "Create a Button". Enter in the name, and all the pricing details. IMPORTANT: Under "Customize Advanced Details", enter the following:

notify_url=https://www.mywebsite.com/PayPal_IPN

Replace the URL with the URL of the applicable IPN script for that button.

There are 4 IPN scripts (one for op, that you might want to take out).

Enter the URL of each IPN script for each product.

The script will email the redemption code to their paypal email.

In the beginning of each script (right after <?php), you have to edit the database information to match your own.

http://www.kewlimg.net/ipn.zip

DISCLAIMER: I have tested this code, but I take ABSOLUTELY *NO* responsibility for ANYTHING that you do with this code! Anything that you do is YOUR responsibility.