[DEV/WEB] WebSend v2.4 - Use PHP and other web-languages for bukkit! [1.4.7-R1.0]

Discussion in 'Archived: Plugin Releases' started by Waterflames, Jul 21, 2011.

  1. Offline

    Waterflames

    websend-icon-text-smaller.png

    WebSend - Use PHP for Bukkit!:
    Version: v2.3
    BukkitDev: http://dev.bukkit.org/server-mods/websend/
    What does this plugin do?
    A scheme:
    Ingame command -> Your php-enabled server
    -> Your PHP file does stuff and provides output/commands -> Plugin executes commands and prints output.
    Or:
    Webpage command -> bukkit server -> Plugin executes commands and prints output.

    Example scripts are provided in the files.
    !!! IMPORTANT NOTE !!!
    Use the bukkitDev forum for bugs, questions and other stuff. I will no longer respond here!

    A few of the possibilities:
    • Online adminstration screen
    • Online console
    • Membership system (become VIP with a donation)
    • Paypal donation system
    • ...
    Features:
    • Seperate thread (no server lag because of the wait.)
    • Commands (ingame or console emulation)
    • Command to color output send from php.
    • Secure connection (protected with password hash)
    • Permissions support (just "websend")
    • Both ways enabled (PHP -> bukkit | bukkit -> php (-> bukkit))
    Installation: (more detailed instructions can be found on bukkitdev):
    1. Put the plugin in the plugin folder.
    2. Start/reload server to allow the config file to be generated.
    3. Open the example php file and fill in your password.
    4. Upload the example php file to your server.
    5. Open the config file and fill in the settings.
    6. Reload server and test with "/ws timeset".
    7. Go to the bukkitDev page to find instructions to get started.
    Download on bukkitdev.

    Changelog:
    Show Spoiler

    For more changelog, visit the bukkitdev "files" section.
    Version 0.9:
    • Fixes false error reporting
    • A debug feature was added.
    Version 0.8.1:
    • Couple of small bugfixes for 1240
    Version 0.8:
    • Added error report on invalid /Command/
    • Added warning if the first line doesn't contain the password.
    • Added proper disabling code for ServerSocket.
    • Tweaked the variable checking.
    Version 0.7.1:
    • Added extra POST data. (Info)
    Version 0.7:
    • Enabled input from console
    • Implemented a config line to use a custom port.
    Version 0.6:
    • Added extra POST data. (Info)
    Version 0.5:
    • Added the other way (PHP -> bukkit) Port 4445 needs to be forwarded.
    • Improved config file reading
    • Optimized code structure.
    Version 0.4:
    • Added option to use port 4444 opposed to the default
    Version 0.3:
    • Added color feature. (examples in supplied zip.)
    • Added Console command option (Use /Command/ExecuteConsoleCommand)
    Version 0.2
    • Fixed permissions plugin absence error.
    Version 0.1
    • Plugin released
     

    Attached Files:

  2. Offline

    marotoweb

    Code:
    20:54:24 [INFO] Websend: ServerSocket: activated.
    
    20:54:24 [SEVERE] null
    
    java.net.BindException: Address already in use
    
    at java.net.PlainSocketImpl.socketBind(Native Method)
    
    at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:365)
    
    at java.net.ServerSocket.bind(ServerSocket.java:319)
    
    at java.net.ServerSocket.<init>(ServerSocket.java:185)
    
    at java.net.ServerSocket.<init>(ServerSocket.java:97)
    
    at websend.PHPSktSrvrThread.run(Main.java:312)
    
    20:54:28 [INFO] Connection reset
    1º It's possible to add world name in $_POST?

    2º It's possible to add new syntax like sleep or pause

    Example: bukkit -> php -->bukkit
    /Command/ExecuteConsoleCommand: say Day in 5 seconds;
    /Command/Sleep: 5;
    /Command/ExecuteConsoleCommand: time day;


    I can't use sleep in php to add time between commands interpreted by websend

    By the way, its an amazing plugin, nice work ;)
     
  3. Offline

    Waterflames

    I'll see how I could implement that.

    !!! IMPORTANT NOTE !!!
    Use the bukkitDev forum for bugs, questions and other stuff. I will no longer respond here!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  4. Offline

    Snwspeckle

    How can we link into the Bukkit API so that we can check for information like by using textfields to get users minecraft names and to check they are online? Not sure how to format that if statement.
     
  5. Offline

    Cr4k3rd

    config.txt :
    httpconsole.php :
    PHP:
    <?php
    function HTTPConsole($command) {
     
    $host 'localhost';
     
    $port 4445;
     
    $sock socket_create(AF_INETSOCK_STREAM0) or die('Erreur : Impossible de créer le socket.');
     
    $succ socket_connect($sock$host$port) or die('Erreur : Impossible de se connecter au serveur.');
     
    socket_write($sock$login md5('HTTPConsole').'<Password>'strlen($login) + 1) or die('Erreur : Échec de l\'écriture du socket.');
     
    socket_write($sock$command '/Command/ExecuteConsoleCommand:'.$command.';'strlen($command) + 1) or die('Erreur : Échec de l\'écriture du socket.');
    }
    echo 
    HTTPConsole($_GET['command']);
    ?>
    I run it like this for the command "list" : http://www.website.com/httpconsole.php?command=list


    The command runs fine but how to retrieve the response from the console to see which players are connected ?

    Thank you in advance. :)
     
  6. Offline

    Waterflames

    Please us the bukkitdev forum. :)
    http://dev.bukkit.org/server-mods/websend/
     
  7. Offline

    Mr_H4mm3r

    Can someone please make a PhpBB3 setup so you need to be registered on the forum for not being on the greylist on the server??
     
  8. Offline

    Waterflames

    I suggest using the devbukkit or bukkit forum, there are others working on this too.
     
  9. Offline

    Mr_H4mm3r

    Thanks :)
     
  10. Offline

    Waterflames

    Just a quick reminder: Don't post here, post in the bukkitdev forum. (link in first post.)
     
  11. Offline

    Filip Weiss

  12. Offline

    Waterflames

    Thank you :D
     
  13. Offline

    RG_PankO

    I am getting this:

    Code:
    Warning: socket_connect() [function.socket-connect]: unable to connect [0]: No connection could be made because the target machine actively refused it. in C:\xampp\htdocs\lala\ExternalTimeSet.php on line 9
    error: could not connect to host
    What am I missing? Waterflames
     
  14. Offline

    Waterflames

    Try asking here: http://dev.bukkit.org/server-mods/websend/forum/
     
  15. Offline

    RG_PankO

  16. Offline

    bonani

  17. Offline

    Waterflames

    I dont immediatly see the error, try posting this question in the bukkitdev forum.
     
  18. Offline

    bonani

    Thanks Waterflames, should have read the thread before posting.
     
  19. Offline

    Shandy

    Heya i really do hate to point out a flaw in one of the most awsome plugins ive ever found but it seems that you have got a real issue with how data is sent and recieved im not trying to be horrible however ive seen to versions of this the first version uses CURLS to send and recieve data now alot of web hosting companys have this enabled but it is disabled as default and if they dont give u access to a custom php file you cant change this then comes the alternative which uses sockets this works great as far as i can see on again most premium web hosting companys but again some disable sockets under fear of hacking and when you dont have access to a custom php file you cant change this this therefor leaves us with no method of sending or recieving data is there no way you could find some more alternatives to transmitting data i love your plugin you are awsome but sorry to present this :(
     
  20. Offline

    RROD

    Love it. I wish I had this resource around when I was starting out on plugin development, I would have made an extension for it.
     
  21. Offline

    Filip Weiss

    I improved your minecraft.php a bit:

    PHP:
    <?php
    //variables
    /*********************************** Variables ***********************************/
    /**/  
    $checkpass "PutYourPasswordHere";
    /*********************************************************************************/
    /**/  
    $receivedMD5 $_POST['authKey'];
    /**/  $player $_POST["player"];
    /**/  $args $_POST["args"]; //each argument is stored in an array called "args"
    /*********************************************************************************/
     
    //Do not edit!
    if($receivedMD5 != "" && $args[0] != "") exit("No (enough) data provided.;");
    if(
    $receivedMD5 == md5($checkpass)) exit("Authorization Failed;");
     
     
    //Begin your code here.
    if($args[0] == "checkcolors"//script 1
    {
        print(
    'Example script from php.;');
        print(
    'This command will show different possible colors;');
        
    // use /Chatcolor-red: to set the text of a sentence to red.
        // Other colors are:
        
    print("/Chatcolor-red:This is red;");
        print(
    "/Chatcolor-green:This is green;");
        print(
    "/Chatcolor-blue:This is blue;");
        print(
    "/Chatcolor-yellow:This is yellow;");
        print(
    "/Chatcolor-white:This is white;");
        print(
    "/Chatcolor-purple:This is purple;");
        print(
    "/Chatcolor-gray:This is gray;");
        print(
    "/Chatcolor-gray:These are /Chatcolor-blue:multiple colors/Chatcolor-red: in one/Chatcolor-purple: sentence;");
    }
    elseif(
    $args[0] == "timeset"//script 2
    {
        print(
    'Success;');
        print(
    'Example script from php.;');
        print(
    'This will set the time of players world to day.;');
        
    // use /Command/ExecuteBukkitCommand: to indicate a command sent by $player.
        // Behind that line you can put any player chat command.
        
    print("/Command/ExecuteBukkitCommand:time day;");
        print(
    "Player = ".$player.";");
        print(
    "Argument 1 = ".$args[0].";");
    }
    elseif(
    $args[0] == "weatherset"//script 3
    {
        print(
    'Success;');
        print(
    'Example script from php.;');
        print(
    'This will set the weather of players world to sun.;');
        
    // use /Command/ExecuteBukkitCommand: to indicate a command sent by $player.
        // Behind that line you can put any player chat command.
        
    print("/Command/ExecuteBukkitCommand:weather sun;");
        print(
    "Player = ".$player.";");
        print(
    "Argument 1 = ".$args[0].";");
    }
    elseif(
    $args[0] == "consoleCommand"//script 4
    {
        print(
    'Example script from php.;');
        print(
    'This command will send a command to the console.;');
        if(
    $player == 'console')
        {
            print(
    '"Error: Only in-game players can use this command.";');
        }
        else
        {
            print(
    'Proof it is send to console:;');
            
    // use /Command/ExecuteConsoleCommand: to indicate a command from console.
            
    print("/Command/ExecuteConsoleCommand:say Hello World;");
        }
    }
    else
    {
        print(
    'Websend: Unknown command.;');
    }
     
    ?>
    Not tested but should work fine.
     
  22. Offline

    Fatih199415

    Please update it.
    Didn´t work with Version: 1.2.5-R1.0 (Build #02149
    This is a EPIC Plugin :)
     
  23. Offline

    Waterflames

    It does work.

    Download it on BukkitDev.
     
  24. got everything in place but cant get it working.
    can u help me?
     
  25. Offline

    Paddy_Herrmy

    Please.. UPDATE... This plugin is verry essential vor my Server...
    error messages:
    [​IMG]
     
  26. Offline

    Waterflames

    WSEvents 1.4 release candidate is finished and will be released soon.
     
  27. Offline

    kevinken88

    Thanks for share. I'm needing it.
     

Share This Page