Advertisement
Guest User

Websend > minecraft.php

a guest
Jun 18th, 2016
423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.32 KB | None | 0 0
  1. <?php
  2. //variables
  3. /*********************************** Variables ***********************************/
  4. /**/  $checkpass = "****";
  5. /**/  $hashAlgorithm = "sha512";
  6. /*********************************************************************************/
  7. $receivedHash = $_POST['authKey'];
  8. $args = $_POST["args"]; //each argument is stored in an array called "args"
  9. if($_POST['isCompressed'] == "true" && isset($_FILES['jsonData']['tmp_name'])){
  10.     $json = json_decode(gzdecode(file_get_contents($_FILES['jsonData']['tmp_name'])));
  11. }else{
  12.     $json = json_decode($_POST["jsonData"]);
  13. }
  14. if($json == ''){
  15.     print('/Output/PrintToConsole:Error:Failed to retrieve JSON data!;');
  16.     //If compressed is enabled PHP probably refused the binary data: check upload_max_filesize, post_max_size and file_uploads
  17. }
  18. /*********************************************************************************/
  19.  
  20. $invoker = $json->{'Invoker'}->{'Name'};
  21.  
  22. if($receivedHash != "" && $args[0] != "")
  23. {
  24.     if($receivedHash == hash($hashAlgorithm, $checkpass))
  25.     {
  26.         //Begin your code here.
  27.         if($args[0] == "checkcolors") //script 1
  28.         {
  29.             if($invoker == '@Console')
  30.             {
  31.                 print('/Output/PrintToConsole:Error: Only in-game players can use this command.;');
  32.             }else{
  33.                 print('/Output/PrintToPlayer:Example script from php.;');
  34.                 print('/Output/PrintToPlayer:This command will show all possible colors;');
  35.                 // use minecraft color codes to color the text
  36.                 print("/Output/PrintToPlayer:&aThis is green;");
  37.                 print("/Output/PrintToPlayer:&bThis is light blue;");
  38.                 print("/Output/PrintToPlayer:&cThis is red;");
  39.                 print("/Output/PrintToPlayer:&dThis is pink;");
  40.                 print("/Output/PrintToPlayer:&eThis is yellow;");
  41.                 print("/Output/PrintToPlayer:&fThis is white;");
  42.                 print("/Output/PrintToPlayer:&1This is dark blue;");
  43.                 print("/Output/PrintToPlayer:&2This is dark green;");
  44.                 print("/Output/PrintToPlayer:&3This is aqua;");
  45.                 print("/Output/PrintToPlayer:&4This is dark red;");
  46.                 print("/Output/PrintToPlayer:&5This is purple;");
  47.                 print("/Output/PrintToPlayer:&6This is gold;");
  48.                 print("/Output/PrintToPlayer:&7This is grey;");
  49.                 print("/Output/PrintToPlayer:&8This is dark grey;");
  50.                 print("/Output/PrintToPlayer:&9This is blue;");
  51.                 print("/Output/PrintToPlayer:&0This is black;");
  52.                 print("/Output/PrintToPlayer:&7These are &1multiple colors &cin one &5sentence;");
  53.             }
  54.         }
  55.         elseif($args[0] == "timeset") //script 2
  56.         {
  57.             if($invoker == '@Console')
  58.             {
  59.                 print('/Output/PrintToConsole:Error: Only in-game players can use this command.;');
  60.             }else{
  61.                 print('/Output/PrintToPlayer:Success;');
  62.                 print('/Output/PrintToPlayer:Example script from php.;');
  63.                 print('/Output/PrintToPlayer:This will set the time of players world to day.;');
  64.                 // use /Command/ExecuteBukkitCommand: to indicate a command sent by $invoker.
  65.                 // Behind that line you can put any player chat command.
  66.                 print("/Command/ExecuteBukkitCommand:time day;");
  67.                 print("/Output/PrintToPlayer:Invoker = ".$invoker.";");
  68.                 print("/Output/PrintToPlayer:Argument 1 = ".$args[0].";");
  69.             }
  70.         }
  71.         elseif($args[0] == "weatherset") //script 3 example using a plugin command to change the weather
  72.         {
  73.             print("/Command/ExecuteConsoleCommand:weather sun;");
  74.             print("/Command/ExecuteConsoleCommand:".$invoker.";");
  75.             if($invoker == '@Console')
  76.             {
  77.                 print('/Output/PrintToConsole:Weather changed.;');
  78.                 print("/Output/PrintToConsole:Player = ".$invoker.";");
  79.                 print("/Output/PrintToConsole:Argument 1 = ".$args[0].";");
  80.             }else{
  81.                 print('/Output/PrintToPlayer:Weather changed.;');
  82.                 print("/Output/PrintToPlayer:Player = ".$invoker.";");
  83.                 print("/Output/PrintToPlayer:Argument 1 = ".$args[0].";");
  84.             }
  85.         }
  86.         elseif($args[0] == "consoleCommand") //script 4
  87.         {
  88.             print('/Output/PrintToPlayer:Example script from php.;');
  89.             print('/Output/PrintToPlayer:This command will send a command to the console.;');
  90.             if($invoker == '@Console')
  91.             {
  92.                 print('/Output/PrintToConsole:Error: Only in-game players can use this command.;');
  93.             }
  94.             else
  95.             {
  96.                 print('/Output/PrintToPlayer:Proof it is send to console:;');
  97.                 // use /Command/ExecuteConsoleCommand: to indicate a command from console.
  98.                 print("/Command/ExecuteConsoleCommand:say Hello World;");
  99.             }
  100.         }
  101.         else
  102.         {
  103.             print('/Output/PrintToPlayer:Websend: Unknown command.;');
  104.         }
  105.         //Stop editing here.
  106.     }
  107.     else
  108.     {
  109.         print('/Output/PrintToConsole:Authorization Failed;');
  110.     }
  111. }
  112. else
  113. {
  114.     print("/Output/PrintToConsole:No (enough) data provided.;");
  115. }
  116. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement