[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



    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.
    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
    • ...
    • 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.

    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


    yes i try it in the server console
  3. Offline


    The console is not supported for now.
  4. Offline


    ah ok now i try it in the client
    but the console show me
    20:22:44 [INFO] No permissions found, defaulting to OP.
    20:22:45 [INFO] ♠±õÙ│gÿM        ╩ø@
    but i am a OP. Is it possible to host the game and the web server on the same PC ??
  5. Offline


    I think its possible by using "localhost" as url, but I'm haven't tested it.

    Also, what other plugins are on your server?
  6. Offline


    How to use the built in funtions. I dont understand how to use it. I always get "not enought data provided"
  7. Offline


    Have you set it up correctly, following the steps provided in the start post?
    Also, could you be a little more specific about the "built in funtions" please, do you mean like the template in the download?
  8. Offline


            elseif($args[0] == "weatherset"){ //script 2
    'Example script from php.;');
    'This will set the weather of players world to sun.;');
    // use /Command/ExecuteBukkitCommand: to indicate a command.
                // Behind that line you can put any player chat command.
    print("/Command/ExecuteBukkitCommand:weather sun;");
    "Player = ".$player.";");
    "Argument 1 = ".$args[0].";");
    How do i use that. eitherwise how do i use it :p which url should it be example i want to execute kick someone on localhost
  9. Offline


    I was looking for a plugin that would do the opposite - send data to the server via PHP, without needing to use a command.

    But I must say, this is a pretty cool plugin. I don't know JAVA, but I am pretty good with PHP. This plugin will allow me to create my own stuff in PHP with out having to know JAVA. Although, it's obviously limited, as I have to rely in other plugins I have, but still cool nonetheless.
  10. Offline


    I have no other plugins on my server..
  11. The Webserver is installed on a virtuel maschine.
    I test the local ip next time i have time.
  12. Offline


    So the game server and the webserver are on the same virtual machine?
    If yes, try replacing the url with the local url. (localhost, or maybe /home/username/phpfile.php or something like that.)

    Based on what trigger then? Like startup or something? I can do that.

    Honestly, I have no idea what it could be. Maybe try installing permissions and see if permissions are the actual problem.

    Kicking, for example, would become:
            elseif($args[0] == "kick"){ //script 2
    print('Kicking player '.$args[0].';');
    print("/Command/ExecuteBukkitCommand:kick '.$args[1] .';");
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 17, 2016
  13. Offline


  14. Offline


    No, just http://localhost/websend.php cause its POST method

    Command in game:
    /ws first second
    $args $_POST["args"];
    $args[0//is "first"
    $args[1//is "second"
  15. The Minecraft Server is on the Host and the webserver on a virtual maschine on the Host.
    so nothing local ;/
  16. Offline


    For example, I'd like to make a page called "rules.php" with a list of the rules for the server, where a user can enter his/her name, and press accept. Then once they do that, I have the ability to send the command "/permissions -reload world" to the server via PHP.

    At the moment, they have to use the command "/ws build" in game to get building rights.
  17. Offline


    Well, since the virtual machine acts like seperate machine, you could try 192.168.1.numberofvirtualmachine

    So, like:
    User goes to webpage and clicks button/enters some text and the php contacts the minecraft server to execute a command?

    I could swear there is already a plugin for that. Still I'll implement it, if you really want it.
  18. java.net.ConnectException: Connection timed out
    I try the Idea from you.

    It Work ;)
    but no on Port 80 ;/

    I love it :D

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


    Thank you =D

    OK, so I builded a untested development build. (Big chance it won't work)
    if you add WEBLISTENER_ACTIVE=true to the config file, it will start a socketserver on port 4445 that you should be able to write commands to like this:
    $PORT 4445;
    $HOST "localhost"//the ip of the bukkit server (in this case it's the same machine)

    $sock socket_create(AF_INETSOCK_STREAM0//Creating a TCP socket
    or die("error: could not create socket\n");

    $succ socket_connect($sock$HOST$PORT//Connecting to to server using that socket
    or die("error: could not connect to host\n");

    $text "/Command/ExecuteConsoleCommand:time day;"//the text/command we want to send to the server

    socket_write($sock$textstrlen($text) + 1//Writing the text to the socket
    or die("error: failed to write to socket\n");
    PHP code based on this article.

    I'll try it myself tomorrow.
    BTW: Don't forget to check port forwarding.

    Fixed a small but severe bug which caused the server to endlessly try to create a new ServerSocket.
    Workes for me now.

    Attached Files:

    Last edited by a moderator: May 18, 2016
    RastaLulz likes this.
  20. Offline


    I have a request. Could you make it execute the script each time a player joins, and leaves, perhaps? So custom and dynamic welcome messages could be made.
  21. Offline


    Handling the event wouldn't be a problem, but what do I send with it? (playername, location,...)
  22. Offline


    All that you think could be useful? x3 Including player name, yes.
    Another suggestion, possibly timed events? So that the script can display some information at certain intervals in time?
  23. Offline


    In the latest released development release (not official), there is a function to execute code and show stuff without events. Maybe it is possible to set up a timer in php?
  24. Offline


    Setup a timer in PHP? What do you mean by that?
  25. Offline


    The certain intervals in time.
    Like a send- message command and a sleep() in a while loop.
  26. Offline


    Oh. But wouldnt that have to have the server execute the script indefinitely? I think there's a time limit on how longs scripts can run in PHP. :confused:
  27. Offline


    Well you could use set_time_limit(99999999999999999999999999999999999999999999999); :p

    I see your problem with this. I guess the best solution is to let the java pass a custom event to the php on the interval specified.

    Right now, I'm restructuring the code a bit and polishing the socket stuff, after that I'll look into new events.
  28. Offline


    You want : CronJob
  29. Offline


    Cron, yes. But the problem is, how can i summon a script to run and return data to minecraft from outside of minecraft?
  30. Offline


    Check post #54, #59 and #60
  31. Offline


    Im not completely sure if this is the plugin i want for this kind of thing but it seems right.

    what i want to accomplish is this.
    In my forum all users are set to user after making a account, could this plugin be implemented in a way that when i upgrade the forum users to a better group say "whitelisted" your plugin would then send a whitelist command to the server?

Share This Page