Check for latest version?

Discussion in 'Plugin Development' started by Milkywayz, Mar 24, 2012.

Thread Status:
Not open for further replies.
  1. Offline


    Hey i want to implement a feature where when a OP joins it alerts them that my plugin has a update available. I own a website where i can put a simple string "2.5", which would represent the current version, when i finish 2.6, i change the value on the website then the plugin recognizes that its out of date and alerts ops when they join that a new version is available.
  2. Offline


    This thread isn't really related to the bukkit API, but Java has some built-in methods to process an URL and then open a stream to a web page, which you can then process raw or I think Java even has an HTML parser, and if not, then use a third party library HTML parser. I'd recommend you embed the version number into a HTML comment tag. Your website visitors won't see it unless they view page source, and it's easier to parse that way if you are looking for a specific tag. I can't remember of the top of my head on how to go about this in Java, but I do know that the built-in functionality is there in all official Sun JRE libraries. If anything else, do it all raw and manually. (Ex.: Open a socket to website, form the HTTP protocol header and request for the page with embedded comment, parse the HTTP server response header, and if HTTP OK, then parse protocol body data) I'm experienced with the subject. However, it's been so long since I have applied the knowledge. Trying to remember details poses the needle in the haystack scenario.

    EDIT: You can keep the version number in a MySQL database and have your plugin connect to it. This is a much more solid approach IMHO.
  3. Offline


    Thanks for the info, i asked here because the examples i found online weren't really helpful.
  4. Offline


    It's not a problem. I felt to point it out so you would seek out Java-oriented forums for help on interacting with a website. However, another approach is to use a database, which heavily abstracted API's exist to make connecting and querying databases easier. Java has the JDBC interface which require an implementation driver to use, and MySQL just so happens to have a JDBC driver available. MySQL FTW! :) Besides databases are much more suited to house data for applications (or plugins in your case).
  5. Offline


    I like the way how Vault does it. There's a rss-feed for the files on bukkitDev, so you can check the feed it there's a newer version available.
    Milkywayz likes this.
  6. Offline


    Hmm thanks ill check out the vault source code EDIT: Worked out well, thanks!
  7. Offline


    Coding wise -by way of snippets-, how are you guys going about it? My plugin is being used on some servers where port 80 is being blocked and for some reason this crashes out the entire server while it waits for a response it won't get. Any help?
Thread Status:
Not open for further replies.

Share This Page