AutoUpdater... Please help..

Discussion in 'Plugin Development' started by xYourFreindx, Jun 7, 2014.

Thread Status:
Not open for further replies.
  1. All I'm trying to do, is let admins know when there's an update upon joining.
    Here's what I've got...​
    Code:java
    1.  
    2. Updater updater = new Updater(this, #####, this.getFile(), Updater.UpdateType.NO_DOWNLOAD, false);
    3.  
    4. @Override
    5. public void onEnable() {
    6. getConfig().options().header("[URL]http://dev.bukkit.org/bukkit-plugins/cameramode/pages/config-yml-explained/[/URL]");
    7. getConfig().options().copyHeader(true);
    8. getConfig().options().copyDefaults(true);
    9. if (getConfig().getBoolean("CameraMode.Enabled") == false) {
    10. getLogger().info("Plugin Disable Setting Detected...");
    11. getServer().getPluginManager().disablePlugin(this);
    12. }
    13. getServer().getPluginManager().registerEvents(this, this);
    14. PluginDescriptionFile pdfFile = this.getDescription();
    15. getLogger().info(pdfFile.getName() + " v" + pdfFile.getVersion() + " has been enabled");
    16. }

    Code:java
    1.  
    2. @EventHandler
    3. public void onPlayerJoin(PlayerJoinEvent e){
    4. if (updater.getResult().equals(UpdateResult.UPDATE_AVAILABLE)) {
    5. if (updater.getLatestType().toString().equalsIgnoreCase("release")){
    6. if (e.getPlayer().hasPermission("cameramode.update")){
    7. e.getPlayer().sendMessage(ChatColor.DARK_AQUA + "CameraMode: " + ChatColor.AQUA + "New Update Available!");
    8. e.getPlayer().sendMessage(ChatColor.DARK_AQUA + "CameraMode: " + ChatColor.DARK_GRAY + updater.getLatestFileLink().toString());
    9. }
    10. }
    11. }
    12. }

    And then the Updater Class.
    I'm not getting any errors in eclipse... And I'm not getting any errors on console. But I'm also not getting any notification when I join the server with the correct permissions.
    Yes I made sure to define them in the plugin.yml.
    Yes I'm using the real number, not #####.
    I've followed as many tutorial threads as I could find. But with little help.

    Updater updater = new Updater(this, #####, this.getFile(), Updater.UpdateType.NO_DOWNLOAD, false);
    When I put ^ in my onEnable, my main class does not allow me to call "updater" and therefor, I cannot do anything with it's class that I need to. Like make the config option on whther or not the server owner wants there to be a download, or notifying an admin on join.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Nov 2, 2016
Thread Status:
Not open for further replies.

Share This Page