Spigot resources API

Discussion in 'Spigot Discussion' started by woutwoot, May 29, 2015.

  1. Is there, or will there ever be a Spigot resources API? (A bit like the bukkidev API, or bukget)
    This would be very useful to create auto-updaters for plugins, and if designed properly, even Premium plugins.
    I'd like to hear some thoughts on this. @md_5 ?
     
  2. clip

    Benefactor

    You can use maxims SpigotSiteApi to do this Although an official API would be great.
    https://github.com/Maximvdw/SpigotSite-API
     
    • Agree Agree x 2
  3. This is what I've been able to figure out about what is available already, and what we could use:
    • Use http://www.spigotmc.org/resources/resourceId/download?version=versionId to get a download link.
    • Using something like this is possible (API key is always the same):
      Code (Text):
      /**
           * Asks spigot for the version
           */
          private String getSpigotVersion() {
              try {
                  HttpURLConnection con = (HttpURLConnection) new URL("http://www.spigotmc.org/api/general.php").openConnection();
                  con.setDoOutput(true);
                  con.setRequestMethod("POST");
                  con.getOutputStream().write(
                          ("key=98BE0FE67F88AB82B4C197FAF1DC3B69206EFDCC4D3B80FC83A00037510B99B4&resource=81").getBytes("UTF-8"));
                  String version = new BufferedReader(new InputStreamReader(con.getInputStream())).readLine();
                  if (version.length() <= 7) {
                      return version;
                  }
              } catch (Exception ex) {
                  System.out.print("[LibsDisguises] Failed to check for a update on spigot. Now checking bukkit..");
              }
              return null;
          }
    • Use https://github.com/Maximvdw/SpigotSite-API
    • Best but complicated solution: create a xenforo plugin (https://xenforo.com/community/resources/categories/development-tutorials.36/)
     
    #3 woutwoot, May 29, 2015
    Last edited: May 29, 2015