[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

    Jonchun

    Still nothing.

    Console Output:
    On Startup

    Code:
    2011-08-22 03:43:35 [INFO] Websend: ServerSocket: activated.
    
    On run of test.php
    Code:
    2011-08-22 03:43:45 [INFO] Websend: ServerSocket: connection accepted.
    2011-08-22 03:43:45 [INFO] Websend: ServerSocket: InputStream retrieved.
    2011-08-22 03:43:45 [INFO] Websend: ServerSocket: Line: md5($password);/Command/ExecuteConsoleCommand:say test;Time set to day;
    2011-08-22 03:43:45 [SEVERE] Exception in thread "Thread-8"
    2011-08-22 03:43:45 [SEVERE] java.lang.ArrayIndexOutOfBoundsException: 1
    2011-08-22 03:43:45 [SEVERE]     at websend.PHPSktSrvrThread.run(Main.java:302)
    
    test.php
    PHP:
    <?php
    $PORT 
    4445;
    $HOST "209.188.8.118"//the ip of the bukkit server (in this case it's the same machine)
    $password "-----";

    //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:say test;"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");
    ?>
    - Yes, Yes, Yes, Yes, Yes, Yes

    config.txt
    Code:
    #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).
    URL=http://localhost/websend/minecraft.php
    PASS=-----
    #Optional settings. Remove the '#' to use.
    #FORCEPORT=false
    #FILE=
    WEBLISTENER_ACTIVE=true
    #ALTPROTECTION=
     
  3. Offline

    Waterflames

    @JagCraft

    Try this php with the regular non debug version:
    PHP:
    <?php
    $PORT 
    4445;
    $HOST "209.188.8.118"//the ip of the bukkit server (in this case it's the same machine)
    $password "-----";

    //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)."<Password>"strlen($command) + 1)
    or die(
    "error: failed to write to socket\n");

    socket_write($sock$command "/Command/ExecuteConsoleCommand:say test;"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");
    ?>
     
  4. Offline

    Jonchun

    Ah there we go... missing the <password>... -_________-

    Edit: Feature Request-- Is it possible for this to work like HTTPConsole so if I went

    /Command/ExecuteConsoleCommand:list

    I would receive output from the server? Also, I don't know if I posted this already but is it possible to have it send usergroups (Permissions 3.x)
     
  5. Offline

    Waterflames

    That is another level of command depth, and the problem with that is that it is pretty hard to get the correct output from the console.

    Like sending which usergroup the player belongs to to the php? If I could get the HTTPConsole-like-thingy to work, then that would be ALOT more efficient and easy.
     
  6. Offline

    Jonchun

    Ok thanks :)

    Now every time a user votes it's announced to the whole world :D
     
  7. Offline

    Waterflames

    Wait, you mean like you want a silent command execution?
     
  8. Offline

    Jonchun

    oh no. the voting was a good thing :3
     
  9. Offline

    Waterflames

    Ok :D
     
  10. Offline

    Techykid3

    I don't get how to use this.I do like the idea of running commands via PHP, but I can't figure it out...
     
  11. Offline

    Waterflames

    Could you be more specific about what exacly you don't understand? Is it the installing, or the making of the scripts,or something else?
     
  12. Offline

    Techykid3

    How to use the PHP scripts and all. I know how to code php, but I dont get how to get it to run a command. when I type /ws or /ws timeset:

    Code:
    2011-08-23 22:06:18 [WARNING] Unexpected exception while parsing console command
    org.bukkit.command.CommandException: Unhandled exception executing command 'ws' in plugin Websend v0.5
    	at org.bukkit.command.PluginCommand.execute(PluginCommand.java:37)
    	at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:129)
    	at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:344)
    	at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:489)
    	at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:468)
    	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:363)
    	at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.command.ColouredConsoleSender cannot be cast to org.bukkit.entity.Player
    	at websend.Main.onCommand(Main.java:179)
    	at org.bukkit.command.PluginCommand.execute(PluginCommand.java:35)
    	... 6 more
    
     
  13. Offline

    mineHAVOC

    i read the 4 pages, but didnt see anything about this exactly,

    Is it possible to have a person enter minecraft IGN in a textfield on a website, linked with a paypal donate button, when people finish the donate and its accepted, it goes back through the confirmation page and then takes the textfield name, and inputs that into the console command and say, promotes them?

    ive been looking for a plugin to do this, but this seems like the closest one. I have coding knowledge, but I can't start from scratch. Im a great manipulator, just not creator :p
     
  14. Offline

    Waterflames

    Enter the command ingame, not in the console.

    Thats possible, if paypal provides a system for your php to know if a person donated. Try here. (A paid paypal account may be required.)
     
  15. Offline

    alfw

    will this script allow all commands?

    like this commands: /i , /bcast, /kick, /ban, /tempban
     
  16. Offline

    Waterflames

    Yes.
     
  17. Offline

    Techykid3

    Okay, I need help setting ALL of this up, I can't get any of this to work, nothing of it :(.

    Example, I can get /ws timeset to work, FROM IN GAME, but how do i execute a command from the website?
     
  18. Offline

    Waterflames

    Like: You go to a webpage, and a command is executed?

    If yes then:
    1. Forward port 4445 on the minecraft server side.
    2. Go to the plugin settings and uncomment (remove the #) the #WEBLISTENER_ACTIVE=true (If you can't find it, paste it in.)
    3. Make a new php file and paste this in:
      PHP:
      <?php
       $HOST 
      "123.456.7.891"//the ip of the bukkit server
       
      $password "YourPasswordHere.";
       
      //Can't touch this:
       
      $sock socket_create(AF_INETSOCK_STREAM0)
       or die(
      "error: could not create socket\n");
       
      $succ socket_connect($sock$HOST4445
       or die(
      "error: could not connect to host\n");
       
      //Authentification
       
      socket_write($sock$command md5($password)."<Password>"strlen($command) + 1)
       or die(
      "error: failed to write to socket\n");
       
      //Begin custom code here.
       
      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");
       
      ?>
    4. Upload it somewhere.
    5. Try it out. Time should be set to day.
     
  19. Offline

    Techykid3

    OMG! Thank you! I now have my automatic promotion system :D
     
  20. Offline

    Waterflames

    No problem :cool:
     
  21. Offline

    Kaosvf

    Hi,
    I kindly need an example of output via php, if I use the command /balance <Player> how can I show the output in my php file?
    Regards.
     
  22. Offline

    Techykid3

    If it was successful, I am unsure, but to put any words there, just put this inside of the { and }'s:

    echo 'your text';
     
  23. Offline

    mineHAVOC

    mind sharing what you got?
     
  24. Offline

    Techykid3

    It's still beta. Problem is with refreshing and promoting them more than once. This also is an application system-all-in-one.
     
  25. Offline

    Waterflames

  26. Offline

    King_KYl3

    Hm wondering does this plugin say rank a player up once they donate on your website?
     
  27. Offline

    Waterflames

    That is one of the possibilities, yes :)
     
  28. Offline

    King_KYl3

    Woah Man i love you no Homo :D but 1 problem :( i dont know how a tut would be so cool if you mayb can great work sir!!
     
  29. Offline

    Waterflames

    Glad you like it :) A tut on how to use the plugin, and do the communication can be found here. How to do the donation part depends on which service you use. (I think you need you need a paid account to use paypal!)
     
  30. Offline

    King_KYl3

    yes im noob with this plugin i would love to know how to make it work like that people donate money thought my website via paypal (allready have :D) and it sends a commands with ranks them to the Vip permission group like /groupset USERNAME VIP :DD so is there anyhow you would please make a tut all this other stuff makes no sence :S Thanks Alot for your help

    And Btw i have a normal server and will be with redstone hosting real soon (hosting company)

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

    Waterflames

    Can you pm me your paypal script? I'll see if I can modify it to work with the plugin.
     

Share This Page