Solved Problem with Auto-Update.

Discussion in 'Plugin Development' started by Experminator, Jan 22, 2015.

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

    Experminator

    Hey Bukkit,

    I have a problem with Auto-Updating.
    I use the Updater of Gravity.

    My log:
    [​IMG]

    My code (Actually only the onEnable method because the updater is only used in that method.):
    Code:
    public void onEnable() {
            getServer().getPluginManager().registerEvents(this, this);
            Updater updater = new Updater(this, 88695, this.getFile(),
                    Updater.UpdateType.DEFAULT, true);
    
            switch (updater.getResult()) {
            case NO_UPDATE:
                getLogger().info("There is no update available at this moment.");
                break;
            case SUCCESS:
                getLogger().info(
                        "Update " + updater.getLatestName()
                                + " is successfully downloaded.");
                break;
            case UPDATE_AVAILABLE:
                getLogger().info("There is a update available!");
                break;
            default:
                updater.setUpdateResult(UpdateResult.DISABLED);
                break;
            }
    
            ShapelessRecipe blindArrow = new ShapelessRecipe(
                    BlindnessArrow.getItem());
            blindArrow.addIngredient(Material.SULPHUR);
            blindArrow.addIngredient(Material.ARROW);
    
            ShapelessRecipe poisonArrow = new ShapelessRecipe(
                    PoisonArrow.getItem());
            poisonArrow.addIngredient(Material.GHAST_TEAR);
            poisonArrow.addIngredient(Material.ARROW);
    
            ShapelessRecipe slownessArrow = new ShapelessRecipe(
                    SlownessArrow.getItem());
            slownessArrow.addIngredient(Material.ENDER_PEARL);
            slownessArrow.addIngredient(Material.ARROW);
    
            getServer().addRecipe(slownessArrow);
            getServer().addRecipe(poisonArrow);
            getServer().addRecipe(blindArrow);
        }
    Greeting,
    Ronald
     
  2. Offline

    567legodude

    @Experminator When I used this in my plugin, it looked something like this:
    Code:
    Updater updater = new Updater(this, id, this.getFile(), Updater.UpdateType.NO_DOWNLOAD, false);
    if(data.getBoolean("checkupdates")) {
        if (updater.getResult() == Updater.UpdateResult.UPDATE_AVAILABLE) {
            for (Player p : Bukkit.getOnlinePlayers()) {
                if (p.isOp()) {
                    p.sendMessage(title + ChatColor.AQUA + "A new version is available: " + ChatColor.YELLOW + updater.getLatestName());
                }
            }
        }
    }
     
  3. Offline

    Experminator

    @567legodude I don't think it matters when i use that code.
     
  4. @Experminator
    "this.getFile()"
    try replacing it with getDescription().getFullName()
     
  5. Offline

    567legodude

    @Experminator Ah, I see the problem. On your bukkit page, you typed the name of the file as "ElementalArrows 1.2"
    The updater has a specific format for searching for versions.
    Go to the bukkitdev page and change the name of the file to "ElementalArrows v1.2"
    upload_2015-1-22_17-51-13.png
    As you can see from the photo, you need to change the name of the file so that it fits the format of the updater.
     
  6. Offline

    Tecno_Wizard

    @Experminator
    He is right, i had this same problem with my other plugin. You can always modify the actual class to fit your nomenclature, but it's probably easier to just fix it on the site.
     
  7. Offline

    Experminator

    @567legodude It looks logic. So i would try. And that message is not really good........
    - I think actually i change the class to accept (1.0 or something instead v1.0, because i don't want to re-upload my plugins).

    - Because then i must re-upload 9 versions again...

    EDIT: Fixed.
     
    Last edited: Jan 23, 2015
  8. Offline

    567legodude

    @Experminator You dont need to re upload the plugins. Just go to the project page. Click files, and rename them.
     
  9. Offline

    Experminator

    @567legodude I saw that already.

    @timtower, @mrCookieSlime or other Staff: Please close this thread.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 13, 2016
  10. Offline

    mrCookieSlime

    Locked on request.

    @Experminator
    Please use the report button for things like this.
     
Thread Status:
Not open for further replies.

Share This Page