Solved Automatically obtaining CraftBukkit/Bukkit updates within Java Program

Discussion in 'Plugin Development' started by collielimabean, Jul 12, 2013.

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

    collielimabean

    Although this isn't a plugin development question, I know that (generally) this is where the programmers hang out.

    I'm not exactly sure how to check for the latest builds for a specific version within a Java program. I look at the URLs for the downloads of Bukkit/CraftBukkit and don't see a pattern. Is the URL generation linked to the build number? Or how is it determined?

    Build 2612 (1.6.2) - http://dl.bukkit.org/downloads/craftbukkit/get/02206_1.6.2-R0.1/craftbukkit-dev.jar (number is 2206)

    Build 2611 - http://dl.bukkit.org/downloads/craftbukkit/get/02204_1.6.2-R0.1/craftbukkit-dev.jar (2204)

    Build 2610 - 2202

    Build 2609 - 2197

    I mean, I could just increment the number found in the URL and have the loop stop when it gets a 404 error after incrementing a certain number of times over the last existing build number, but hopefully there is a more efficient way.
     
  2. Or you could just take a look at the rss (if there's one) and check which one has the highest number == newest build?
     
  3. Offline

    collielimabean

    CaptainBern

    I found a possible solution through the site's XML artifact, found here:
    http://dl.bukkit.org/api/1.0/downloads/projects/bukkit/artifacts/

    In Java, there is an API called XPath, which allows programmers to iterate through an XML file. Thus, I can just open that link in Java, grab that XML, search for all URLs, and then determine latest version. Because the latest version will be a URL, I can just then navigate to the build's download page.
     
Thread Status:
Not open for further replies.

Share This Page