[REQ] Commands to CURL

Discussion in 'Archived: Plugin Requests' started by blazedd, May 11, 2012.

  1. Offline

    blazedd

    Plugin category: Development

    Suggested name: Commands to CURL

    A bit about me: I run my own server and I'm a web developer, however I haven't spent a lot of time with Java (javascript, but not java). I'd love to help as much as I can, but time doesn't allow for me to really spend a lot of time on a plugin like this.

    What I want: What I'm looking for is simple. I need a config.yml file that allows me to set a list of commands that I want to utilize. Ideally these commands would have a low priority and wouldn't be used to override other existing commands. Each command is tied to a URL that gets sent a CURL (or java equivalent) request to. We utilize the JSON plugin so that we don't need this plugin to do anything further. Ideally the plugin will only create the request and validate that a 200 response code was given by the server or validates via JSON {result:'ok'}. Additionally config needs to have a TOKEN which will be validated serverside to ensure spoofing doesn't occur. Lastly the request needs to send the current username. SO an example:

    config:
    link: 'http://site.com/link.php'
    creates command: /link
    when player sends command: [playerOn3] /link
    it sends a GET request to http://site.com/link.php?token=123&player=playerOn3

    config would look something like this: http://puu.sh/tYKd

    Ideas for commands: Reload command and commands issued by config

    Ideas for permissions: Permissions would be issued based off command. Essentially ctoc.COMMANDNAME: true/false

    When I'd like it by: Yesterday, though obviously it'll take a while before anyone more than a few takes notice of this post, I'll keep bumping it.

    Similar plugin requests: None.

    Devs who might be interested in this: not sure
     
  2. Offline

    blazedd

  3. Offline

    JollyGiant16

    Explain it more please.
     
  4. Offline

    blazedd

    Basically I need to be able to create commands that send a GET request to the my web server scripts. Rather than requiring me to edit the plugin, I'd like to update the commands via the config file.

    Each command listed in the config would have a namespace and URL.
    EXAMPLE CONFIG: http://puu.sh/ua9W

    The commands array would generate the namespace for:

    /command
    /sslink

    both would send a request using the token and username of the player that sent the command.

    I'd like to use the two events as well, but that part is easy.
     
    Jok likes this.
  5. Offline

    blazedd

  6. Offline

    MeesterWaffles

  7. Offline

    EarlyLegend

    Why not? There are gabazillions of things you could do with a plugin like this. It basically links your website and forums, including online stats pages etc. with your in game character...

    Sorry I'm nowhere near good enough at Java to help you out here blazedd, but good luck finding a plugin dev :p
     
  8. Offline

    Ne0nx3r0

    blazedd likes this.
  9. Offline

    blazedd

    ne0nx3r0 url-commands is REALLY close to what I want and actually seems to have a lot of cool features I wasn't thinking about. I just wish that I could create namespace commands /[commandname] rather than /ac [commandname].

    EDIT: Looks like the url-commands plugin is borked :(

    MeesterWaffles one of the really fun things about web development is the fact that it's easy to create a website service or store with, but isn't easy to get ingame with. By creating commands to my website I can create a greylist system that requires players to register at our site before getting building permissions, deliver any items from the donations store, sync our bans from our Sourcebans through our forums (and their bans), and even extra stuff like creating a grief report system that creates reports on a web interface for me to see. It gives me coords stored in SQL and I can pull them up without having to write an entire java plugin to do it all. Java's development speed is sluggish and requires a lot of extra effort where PHP (serverside web) programming takes very little effort. If I can get a platform that makes me happy on java I can do a lot without much effort.

    If I had a little more time I could definately do this myself, just time and effort into the plugin makes it difficult to make the plugin.

    PS: anyone who completes the plugin is opt to getting a donations sent their direction.
     
  10. Offline

    Ne0nx3r0

    You could use an alias plugin, I created BetterAlias for this purpose.

    I'll need more detail than that to troubleshoot it :p. Did you download UrlManager? It's required by UrlCommands, and it should yell at you in your server log telling you to get it if you haven't yet.

    Like I said, with UrlManager it should be pretty easy to do what you're asking (it even supports json responses), I wouldn't even mind coding it for you since I already understand the API.
     
    blazedd likes this.
  11. Offline

    se1by

    It's not that hard, you don't even need a third party library.
    If I got time later this evening, I'll see what I can do.
     
    blazedd likes this.
  12. Offline

    blazedd

    ne0nx3r0 I think I love you xD. I'll still be using your BetterAlias because I've been looking for something like this for a while. Also do you have a skype (pm me if you do or another IM). We'd really like the Request to command plugin directly as it has a couple extra things that would be easier if we had a custom plugin (we can release this on dev bukkit, I'm all about keeping it open). JSON is also a lovely addition that I'm always up for.

    EDIT: se1by Your welcome to send me your skype/im as well if your still interested.
     
  13. Offline

    Ne0nx3r0

    Need? No. But I find it's much simpler than trying to recode threaded http requests every time I need that functionality. There are some gotchas with web requests that were bothering me, so I centralized a few private plugin methods into one for ease of maintenance.

    By all means though you can handle this request if you like. I look forward to seeing what you come up with.

    blazedd : I don't know if this is exactly what you're looking for, but I added response commands from the player or console to UrlCommands; seemed like a decent feature:
    http://dev.bukkit.org/server-mods/url-commands/files/5-v0-4/

    So this way you could have something like:
    Code:
    consolecommand: 
      url: http://www.modevs.net/command.php
      params: command
      data:
        key: secret_key
      resultConsoleCommand: "say I've been told to say: %runThis%, I don't know why."
      showPlayerResult: false
    
    with a php file that runs:
    Code:
    <?php
     
    if($_GET['key'] == 'secret_key'){
    echo(json_encode(array(
    'runThis' => $_GET['command']
    )));
    }
     
    ?>
    
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 25, 2016

Share This Page