[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

    ReCreate

    Awesome! Thanks. XD (sorry for late reply)

    I have a question. How can it be possible to make rtriggers summon a command to this? It seems to be able to only run commands in the console, and this only seems to work when you run a command from the client.

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

    Waterflames

    I'll look into it.
     
  4. Offline

    Peepek

    How change a using port? I can't forward 4445 port.
     
  5. Offline

    Waterflames

    Download this, and put ALTPORT=1234 in your config.

    Download the latest version.

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

    ReCreate

    Thanks again! XD
     
  7. Offline

    King_KYl3

    Hey wondering is this possiable to hook this into this site www.enjin.com see this page i made www.kustomcraft.enjin.com on the side you will see a donate pannel can this plugin work with it, so say if some one donates it does a commands and ranks them up Hope you can make it thanks for epic work xD
     
  8. Offline

    Waterflames

    I'm not sure Enjin allows this. I suggest you look at the modules for your page and find a "custom php" module or something like that. If you find one, it may be possible.
     
  9. Offline

    King_KYl3

    Hm i couldnt find one but it has all these modules
    • Aion Armory Search
    • Birthday
    • Chat
    • Claim Code / Key(1)
    • Comments Module
    • Countdown Timer
    • Digital Clock(1)
    • DKP Raid Management (BETA)(1)
    • Event Calendar(1)
    • Event Mini-Calendar(1)
    • Events Upcoming
    • Forum(1)
    • Forum Top Posters(1)
    • Forum Top User Votes
    • Gallery(1)
    • Gallery Slideshow(1)
    • Game Server Status
    • General Form(1)
    • Group Pay
    • Header Module(1)
    • Hit Counter(1)
    • HTML Module(1)
    • Image Upload
    • Latest Matches
    • Latest Members(1)
    • Latest News(2)
    • Latest Threads(1)
    • List(1)
    • Login Module(1)
    • Matches
    • Member Grid
    • Member List & Characters(1)
    • Menu (horizontal)(2)
    • Menu (vertical)(1)
    • Mumble Status(1)
    • News & Blog(1)
    • News Archive(1)
    • News Tag Cloud
    • Online Members(1)
    • Paypal Donations(1)
    • Poll(1)
    • Progression & Achievements
    • Recent visitors
    • Recruitment Form
    • Recruitment Status
    • Rift Guild Perks
    • Rift Recruitment Status
    • RSS Feed(1)
    • Shoutbox(1)
    • Showcase(1)
    • TeamSpeak 3 Status
    • Upcoming Matches
    • User Spotlight(1)
    • Ventrilo Status
    • Visual Raid Progress
    • Visual Roster
    • Website Games(1)
    • WoW Guild Level Perks(2)
    • WOW Guild Tabard
    • WoWProgress Ranks
    • YouTube(1)
     
  10. Offline

    Larsey

    Is there a fix for .NET. I've tried:

    static void Main(string[] args)
    {
    TcpClient clientSocket = new System.Net.Sockets.TcpClient();
    clientSocket.Connect("127.0.0.1", 4445);

    NetworkStream ns = clientSocket.GetStream();

    byte[] outStream = System.Text.Encoding.ASCII.GetBytes("/Command/ExecuteConsoleCommand:give _Larsey_ 264 10");
    ns.Write(outStream, 0, outStream.Length);
    ns.Flush();
    }


    resulted in:

    java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(Unknown Source)
    at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
    at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
    at sun.nio.cs.StreamDecoder.read(Unknown Source)
    at java.io.InputStreamReader.read(Unknown Source)
    at java.io.BufferedReader.fill(Unknown Source)
    at java.io.BufferedReader.readLine(Unknown Source)
    at java.io.BufferedReader.readLine(Unknown Source)
    at websend.PHPSktSrvrThread.run(Main.java:307)

    Anyone?
     
  11. Offline

    Waterflames

    The HTML module may do the job, if you have a extern php webserver. (I use this one.)
    One you have both, you could upload your php scripts to the php host and just use a POST to send data from your enjin page

    Have you tried using a different encoding (UTF-8 maybe)?
     
  12. Offline

    Larsey

    Im stuck, i got this C# code:



    Code:
    TcpClient clientSocket = new System.Net.Sockets.TcpClient();
                clientSocket.Connect("127.0.0.1", 4445);
    
                NetworkStream ns = clientSocket.GetStream();
    
                string password = "141e45baa5a7fdd79f3073406ecf0cda;";
    
                byte[] outStream = System.Text.Encoding.UTF8.GetBytes(password);
                ns.Write(outStream, 0, password.Length);
                ns.Flush();


    Results in this error:

    Code:
    20:33:25 [SEVERE] null
    java.net.SocketException: Connection reset
            at java.net.SocketInputStream.read(Unknown Source)
            at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
            at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
            at sun.nio.cs.StreamDecoder.read(Unknown Source)
            at java.io.InputStreamReader.read(Unknown Source)
            at java.io.BufferedReader.fill(Unknown Source)
            at java.io.BufferedReader.readLine(Unknown Source)
            at java.io.BufferedReader.readLine(Unknown Source)
            at websend.PHPSktSrvrThread.run(Main.java:307)
    I've tried all encodings, the result is the same, does anyone have the solution
     
  13. Offline

    Waterflames

    Have you tried using no encoding?
     
  14. Offline

    King_KYl3

    ok i messaged you :D
     
  15. Offline

    ReCreate

    Hey! I got a few more suggestions. For postdata to send. Bukkit build number, minecraft version number, number of max players, number of current players(Yes i know it already sends a list of players, but its for convenience) and the port that the server is running on. Could you do this? Thank you
     
  16. Offline

    Waterflames

    Implemented everything except mc version number, which I couldn't find a value for.
    Update to get the new version.
     
  17. Offline

    ReCreate

    Thank you!

    Edit: The bukkit version string contains the minecraft version string. so that works just fine!
     
  18. Offline

    Kiste

    Ok, i have no clue what this does, or more precisely "when it does it do it".

    Is every line written on the minecraft server send to all the scripts?
    This really needs explanation on how it sends data to server and when. So it seems to send HTTP requests with POST and GET, but how to trigger this?
    Is it an ingame command like:
    "Meh" says:
    /php domain.com?hello=data yay!
    And Server Recieves:
    $_GET["hello"] = "data";
    $_POST["args"][0] = "Meh":
    $_POST["args"][1] = "yay!";

    I have no clue, what does it do?
    Some Explanation in Startpost or a wiki Page would be really nice so you can figure this out without asking every 3. Page on this topic or bruteforcing minecraft chat. :/
     
  19. Offline

    Waterflames

    I actually have a bukkitdev page. Clicky

    Its actually way simpeler.
    If you follow the instructions on the bukkitdev page and set it up correctly, all you need to do is
    /ws argument1 argument2 argument3
    and so on.

    It will then be send to the predefined php file (defined in config) and will be supplied amongst other data as POST data.

    if you type /ws domain.com?hello=data the output will be $_POST["args"][0] == domain.com?hello=data
     
  20. Offline

    Kiste

    I knew that there is a bukkitdev-site but there is only one page with little text and no links. So it doesn't really help.

    The bukkitdev-page navigation is not just terrible its more like it doesn't seem to exist.:confused:

    unreadable story short:
    No links
    (This page-site-whatever-thing is driving me crazy.)
     
  21. Offline

    Waterflames

    What do you suggest I do? :)
     
    Kiste likes this.
  22. Offline

    Ycros

    Waterflames, can you make the socket restart itself when an exception occurs in your parsing code, currently if someone feeds the socket malformed input the socket server dies completely and you have to /reload to get it back.

    Also, you should document "/Command/ExecuteBukkitCommand-PlayerName:" - it's very useful.
     
  23. Offline

    Kiste

    Better Navigation.

    Links on the Main Page.

    Overall it just needs more links so people who don't know what pages are there can find them.
     
  24. Offline

    Snaipe

    This is awesome. I can finally develop a proper reward system for my donors.

    Only one thing though, for some reason commands cannot be send anymore after some time. I think it's Ycros issue, too, since I have to reload/restart the server to get it to work again. The only thing is that the php page doesn't die in that case, it runs "normally", but nothing happens on the server. I don't want my members to complain when they paid for something and don't get their reward in-game.
     
  25. Offline

    Ycros

    My issue only happened while I was developing my custom PHP client for it, now that I've finished it hasn't ever died since. Maybe you're sometimes sending incorrect data? If you happen to be using PHP lithium, I could share my code. :p

    Ideally the plugin should return a status or result of some sort back, so you can verify if things succeeded.
     
  26. Offline

    Snaipe

    PHP:
    socket_write($sock$command "/Command/ExecuteConsoleCommand:say hello world!;"strlen($command) + 1)
         or die(
    "error: failed to write to socket\n");
    echo 
    "It worked.";
    While this worked at first, it just stops to work randomly - The script displays "It worked.", but nothing happens in-game.
     
  27. Offline

    Waterflames

    Is that the actual command you use, or just a replacement?
     
  28. Offline

    Snaipe

    I used this, as well as
    PHP:
    "/Command/ExecuteConsoleCommand:give " $this->memberData['members_display_name'] . " 1 1;"


    Where $this->memberData['members_display_name'] is a variable containing a player name.

    Both didn't work after some time, and it reworks on restart.

    Moreover, the script can't connect to the socket ( it just dies ) after a while, nothing throws in the console, it just seems fine but it won't work until a restart...

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

    Waterflames

    What other plugins are you running?
     
  30. Offline

    Snaipe

    Show Spoiler
    Administrate 1.3.2-b32
    AllPermissions 1.0
    AmbientSeasons '1.5.0'
    AuthDB 2.3.2.220
    BabelCraft 1.1.0
    BloodMoon 0.3.1
    BookWorm 1.6.1
    CFBanner 1.7
    Citizens 1.1
    ClearInventory 0.3
    ColoredSigns 1.1
    CommandBook "1.5.2"
    CreativeGates 1.1.1
    DreamLand 2.4
    EpicQuest 0.8
    FlatLands 0.1
    Giant Trees 0.3.3
    GlobalChestBanking 1.2.3
    HawkEye 1.0.4b
    HelpPages 1.21
    HeroChat 4.10.3
    HeroicDeath 1.9.1
    Highlighter 0.3
    IPGet 0.5
    InfoApi 0.3.2
    InstaBreak 1.9
    ItemCommands 1.15
    BukkitCompat r15A
    MagicSpells 1.0.3
    MineMaze 1.2
    MobArena 0.94.1
    MobDisguise 1.6
    MobRider 0.39
    MultiInv 2.1.0
    Multiverse-Core 2.0-b228
    NarrowtuxLib 0.7.10
    NearestSpawn 0.6.2
    NetherBan 0.5.1
    Nethrar 2.0
    OneBlock 0.2
    OpenInv 1.3.1
    PermissionsBukkit 1.2
    PlgWarp 2.2
    Praecantatio 1.2
    PreciousStones 6.1
    PressurePort 1.3
    Redstone Spawning 1.4
    RequiPanel 1.0
    SPITEMS 1.1
    ScarredLands 0.1
    Shortcuts 0.2.5
    Showcase 0.7.4
    Spout 1.1.339
    SpoutTrade 1.2
    Superperms bridge
    TeleConfirmLite 1.5
    TimeFold 0.5.beta1
    TooManyBuckets 0.2.1
    Towny 0.74.0
    Trampolin 0.6
    Turnstile 1.9.1
    Vault 1.0.0dev-b21
    WeatherRestrictions 1.7
    Websend 0.5
    WhosThere 1.0
    WorldEdit 4.6
    WorldGuard "5.2.2"
    MultiCurrency 0.1
    Dontkickme 0.1
    dynmap "0.20.1"
    godPowers 2.2
    iConomy 5.01
    pvparena 0.0.4
    Simple Prefix 1.0.1
    SpoutEssentials 3.4


    Using the McMyAdmin Wrapper
     
  31. Offline

    nax_hh

    Well. first of all, amazing plugin. i love it.

    it work well with bukkit -> php -> bukkit but i can't make run with php->bukkit... and that is what i need most.

    Here are some errors i getting:

    When i reload/start server:

    When i use ExternalTimeSet.php

    That sucks... don't seem to be php bad coding..

    anyway, here are some configs..

    php file:

    PHP:
    <?php
    $HOST 
    "127.0.0.1"//the ip of the bukkit server
    $password "test";
    //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");
    ?>

    config file:
    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://192.168.0.13/test/mine/minecraft.php
    PASS=test
    #Optional settings. Remove the '#' to use.
    #FORCEPORT=false
    #FILE=
    WEBLISTENER_ACTIVE=true
    #ALTPROTECTION=25565
    server is using port 4445 and the php file still white.


    plugins:
    all works fine before websend so the errorlog come from it.

    Thanks for help!
     

Share This Page