Solved AutoUpdate code not working.

Discussion in 'Spigot Plugin Development' started by PCPSells, May 27, 2018.

  1. I thought I set this up right, but apparently not.. any help would be greatly appreciated.

    Code -
    Code (Java):
    Player p = (Player) sender;
                    p.sendMessage("works.");
                    boolean isUpdate = checkForUpdate(this, 43584, true);
                    PluginDescriptionFile pdf = this.getDescription();
                    if (p.hasPermission("AltsManager.Auto-Update-Notification")) { /// don't forget to update this on the main resource tab.
                    if (getConfig().getBoolean("settings.Auto-Update")) {
                        if (isUpdate) {
                            p.sendMessage("Update Available");
                          boolean success = download(this, 43584);
                          if (success) {
                              p.sendMessage("Successful Available");
                          } else {
                                p.sendMessage("Unsuccessful Available");
                          }}}}
    I have this set up to a command just so I can check it whenever.
    Whenever I run the command only "works." pops up. (Yes, the resource ID is correct)

    The UpdateAPI I used was from here - https://www.spigotmc.org/resources/updateapi.30630/

    I personally think the reason it's not working is because the resource I'm trying this with is premium. Not sure tho :rolleyes:
     
    #1 PCPSells, May 27, 2018
    Last edited: May 27, 2018
  2. would be better to post all used methods so we can make sure that those methods aren't wrong.
    Pointing to the update methods.
     
  3. I believe the issue is the resource that's trying to update is premium. Would you know a way to fix this?
     
  4. JanTuck

    Supporter

    No, you can't do that sadly.
     
  5. Would there be a way to check the version of a premium resource just to give a player an alert that an update is available?
     
  6. Yes, mine does it. It checks if a newer version is available and sends the server owner a message in the console and in-game.