[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


    The plugin needs port 4445 for PHP->bukkit

    port 4444 is only used when FORCEPORT is activated, and should only be used when absolutely necessary.

    I would say, try different paths. localhost,, C:/ect/ect, yourwebsite.com, ...
  3. Offline


    Argh. I give up. Now that I've figured out bukkit->php->bukkit, I should be able to get it to go from php->bukkit with no problem, right? I turned on

    and altered ExternalTime.php to include:

    $PORT = 4445;
    $HOST = "";
    $password = "*****";
    And then I added

    echo "$command<br>";
    after each line that it sends.

    It says it's successful, that it sent everything just right... but... nothing. The console is silent, there are no chat lines put up... Time doesn't change... nothing. Any thoughts?

    Oh, added bonus: nmap reports that port 4445 is *indeed* open.
  4. Offline


    php->bukkit works with a totally different connection than bukkit -> php->bukkit.
    Try using the vanilla ExternalTimeSet.php with just the host and the password modified. Try setting the host to localhost.

    Vanilla ExternalTimeSet:
    Show Spoiler

    "123.456.789"//the ip of the bukkit server (in this case it's the same machine)
    $password "PutYourPasswordHere";

    //Can't touch this:
    $PORT 4445;
    $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");

    //Begin custom code here.
    socket_write($sock$command md5($password).";"strlen($command) + 1//Put md5(password) first to let the server accept the next commands.
    or die("error: failed to write to socket\n");

    socket_write($sock$command "/Command/ExecuteConsoleCommand:time day;"strlen($command) + 1//Writing text/command we want to send to the server
    or die("error: failed to write to socket\n");

    socket_write($sock$command "Time set to day;"strlen($command) + 1)
    or die(
    "error: failed to write to socket\n");
  5. Offline


    Did so. It's telling me nothing now--Nothing at all. Also, it doesn't update the time or anything.

    Also tried with $HOST= just in case. Still nothing.

    Console gives me no messages, either. Any more thoughts?
  6. Offline


    LOl some1 please do a video im so confusined ill sub who does a vid on how to use the donate one :D

    Hello Please can you :D ^^^^

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


    I don't think this is what you mean, but to show ANY text, by using PHP:

    echo 'My text';
    Would output:
    My text
    on the webpage.

    By the way, @Waterflames

    I love your plugin! I'm using it for SO MUCH right now. Thanks alot :D
  8. Offline


    Does the php file give a connection error? If not, the connection must be succesfull and something very weird is going on.

    Thank you :)

    The donation script needs testing, but installing it should be fairly easy.
    If the plugin is already configured and working; just extract the files, edit some stuff in the config.php, upload it to your website and browse around on your profile looking for a option to enable "auto-redirect".
  9. Offline


    Hm see well im noob as ill wait to some1 else will test to see how it works :D thanks
  10. Offline


    I <3 this plugin!
  11. Offline


    Some1 Please make a video i dont understand this at all i have tried Please!

    Hm I need tut On donate one im so noobish :( LOl

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


    Do you have some time to look at my server configuration? I want to use Php > Bukkit: Ports are forwarded.

    This is my config file:
    #Configuration and settings file!
    #Help: URL: set to the full path of your server php file (see example).
    #Help: PASS: change the password to one of your choice (set the same in the server php file).

    This is my ExternalTimeSet.php:

    $HOST "localhost"//the ip of the bukkit server (in this case it's the same machine)
    $password "test";

    //Can't touch this:
    $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");

    //Begin custom code here.
    socket_write($sock$command md5($password).";"strlen($command) + 1//Put md5(password) first to let the server accept the next commands.
    or die("error: failed to write to socket\n");

    socket_write($sock$command "/Command/ExecuteConsoleCommand:time world day;"strlen($command) + 1//Writing text/command we want to send to the server
    or die("error: failed to write to socket\n");

    socket_write($sock$command "Time set to day;"strlen($command) + 1)
    or die(
    "error: failed to write to socket\n");

    No console messages, Whitescreen on the ExternalTimeSet.php, No ingame changes.
  13. Offline


    The ExternalTimeSet.php is outdated.
    Use this one: http://dev.bukkit.org/server-mods/websend/pages/types-of-communication/#w-php-to-bukkit

    Does this solve your problem?
  14. Offline


  15. Offline


  16. Offline


    Ja een nederlandse server ;),
    We want to automate our whitelist and donations and i'm sure i can create the needed scripts for it but first i'd need to get the starterscript working so i can ensure the server listens to my php.


    Not working. Same thing, Whitescreen, No console msg, No ingame msg. The port is forwarded.
  17. Offline


    192.168.1.numberOfMachineInNetwork maybe?
  18. Offline


    Hooray! It solves *that* problem, quite nicely. (As a note: I had to change the command to 'time set 0' instead of 'time day'... is that a plugin that you're running?)

    Though, a few moments after it became day, I was kicked. Here are the last few moments of console:

    07:59:07 [INFO] nathanaelps [/] logged in with entity id 21948 at ([interim] 509.65945147757145, 108.0, 664.8684821811933)
    08:00:02 [INFO] /Command/ExecuteConsoleCommand:time day
    08:00:02 [INFO] Time set to day
    08:00:24 [INFO] /Command/ExecuteConsoleCommand:time set 0
    08:00:24 [SEVERE] Exception in thread "Thread-8"
    08:00:24 [SEVERE] java.util.ConcurrentModificationException
    08:00:24 [SEVERE]       at java.util.HashMap$HashIterator.nextEntry(HashMap.java:810)
    08:00:24 [SEVERE]       at java.util.HashMap$KeyIterator.next(HashMap.java:845)
    08:00:24 [SEVERE]       at net.minecraft.server.World.setTimeAndFixTicklists(World.java:2271)
    08:00:24 [SEVERE]       at net.minecraft.server.ConsoleCommandHandler.handle(ConsoleCommandHandler.java:256)
    08:00:24 [SEVERE]       at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:401)
    08:00:24 [SEVERE]       at websend.Interpretator.NoPlayerInterpretate(Interpretator.java:83)
    08:00:24 [SEVERE]       at websend.PHPSktSrvrThread.run(Main.java:299)
    08:00:25 [SEVERE] java.lang.IllegalStateException: TickNextTick list out of synch
    08:00:25 [SEVERE]       at net.minecraft.server.World.a(World.java:1976)
    08:00:25 [SEVERE]       at net.minecraft.server.World.doTick(World.java:1736)
    08:00:25 [SEVERE]       at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:444)
    08:00:25 [SEVERE]       at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:363)
    08:00:25 [SEVERE]       at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    08:00:25 [SEVERE] Unexpected exception
    java.lang.IllegalStateException: TickNextTick list out of synch
            at net.minecraft.server.World.a(World.java:1976)
            at net.minecraft.server.World.doTick(World.java:1736)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:444)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:363)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    ...And I still can't log in, six minutes later. It just keeps kicking me with console:

    08:06:18 [INFO] Read timed out
    Restarted the server. Everything stable again.
  19. Offline


    Temporary fix to get in: restart server

    This is very weird. I have never seen this before.
    What plugins are you running?

    About the time day: probably Essentials or worldedit or something like that.
  20. Offline


    With the set i get a nice Socket error cannot connect.
    So i guess the localhost and other local ip was working for the connection but something else is wrong?

    Warning: socket_connect() [function.socket-connect]: unable to connect [0]: Een verbindingspoging is mislukt omdat de verbonden party niet correct heeft geantwoord na een bepaalde tijd, of de gemaakte verbinding is mislukt omdat de verbonden host niet heeft geantwoord. in C:\Users\Nedercraft\Desktop\USBWebserver\root\ExternalTimeSet.php on line 7
    error: could not connect to host 
    Whutwhut, got it working by, using Localhost in the script and in the config ? lol?

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


    SAAY WHUT! Nice!
  22. Offline


    My Whitelist Add command is not executable by console, could i change the ConsoleCommand to playercommand to let my admin username do the command?
  23. Offline


    Not yet, I'll implement it right away.
  24. Offline


    Nice nice, Since my whitelistplugin ( whitelistplus ) is kind of outdated but works fine, it was the only one working properly for my server. We grew pretty big in just 3 months. Eitherway you say you make it possible to execute the script as an admin username in the server instead of ConsoleCommand. or i need the whitelistplus source. Already contacting that plugin author too ;)

    Thanks for helping me out! Soon my whitelist and donations will be automatic ;)
  25. Offline


    Here is a test version: Click

    The interpretor has been modified to also listen to ExecuteBukkitCommand-Playername:Command (notice the dash)
    Example: /Command/ExecuteBukkitCommand-Waterflames:time day

    However, this will require the person mentioned to be online.
  26. Offline


    What about a npc bot ? Possible? My server is 24/7 im not 24/7 ;)

    Going to test the test version, and either i would need an option to not be online or an Npc, Or i need the WhiteListPlus source to let my java scripter fix console commands.
  27. Offline


    Actually I am almost done with fixing WhiteListPlus.

    EDIT: done, WhiteListPlus works from console now.
  28. Offline


    Source is available? there was no link on his plugin forum post? If i had the source my scripter was able to do it. But if you did it i would highly appreciate it.

    - I fail, source is available ;)
  29. Offline


    Actually, it is possible without the source ;)
  30. Offline


    Ok ok, Looking forward for your fix ;), I can only do Php / Sql and Design. Not a java developer. But when i have some spare time i am going to look into java.

    Atm i have the testversion running, but not yet trying out stuff before you reply again ;)
  31. Offline



Share This Page