From bb50313587906049dc54d5da1708cee5e794e4e8 Mon Sep 17 00:00:00 2001 From: rockyhawk64 Date: Tue, 30 Apr 2024 20:13:05 +1000 Subject: [PATCH] 3.21.0.0 --- resource/config.yml | 1 - resource/plugin.yml | 2 +- .../commandpanels/CommandPanels.java | 2 +- .../commandpanels/updater/Updater.java | 19 ++++++++----------- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/resource/config.yml b/resource/config.yml index e6eb4b4..8e7cf56 100644 --- a/resource/config.yml +++ b/resource/config.yml @@ -48,7 +48,6 @@ placeholders: start: '{' end: '}' updater: - auto-update: false update-checks: true purchase: currency: diff --git a/resource/plugin.yml b/resource/plugin.yml index b41141a..f9d6f35 100644 --- a/resource/plugin.yml +++ b/resource/plugin.yml @@ -1,4 +1,4 @@ -version: 3.20.2.0 +version: 3.21.0.0 main: me.rockyhawk.commandpanels.CommandPanels name: CommandPanels author: RockyHawk diff --git a/src/me/rockyhawk/commandpanels/CommandPanels.java b/src/me/rockyhawk/commandpanels/CommandPanels.java index 1599936..60036d0 100644 --- a/src/me/rockyhawk/commandpanels/CommandPanels.java +++ b/src/me/rockyhawk/commandpanels/CommandPanels.java @@ -283,7 +283,7 @@ public class CommandPanels extends JavaPlugin{ //save files panelData.saveDataFile(); inventorySaver.saveInventoryFile(); - updater.autoUpdatePlugin(this.getFile().getName()); + updater.updatePlugin(this.getFile().getName()); Bukkit.getLogger().info("RockyHawk's CommandPanels Plugin Disabled, aww man."); } diff --git a/src/me/rockyhawk/commandpanels/updater/Updater.java b/src/me/rockyhawk/commandpanels/updater/Updater.java index 88a84d8..30aa7de 100644 --- a/src/me/rockyhawk/commandpanels/updater/Updater.java +++ b/src/me/rockyhawk/commandpanels/updater/Updater.java @@ -104,7 +104,7 @@ public class Updater implements Listener { } //the pluginFileName can only be obtained from the main class - public void autoUpdatePlugin(String pluginFileName){ + public void updatePlugin(String pluginFileName){ if (Objects.requireNonNull(plugin.config.getString("updater.update-checks")).equalsIgnoreCase("false")) { return; } @@ -113,23 +113,20 @@ public class Updater implements Listener { String thisVersion = plugin.getDescription().getVersion(); //manual download, only if it was requested - if(downloadVersionManually != null) { - if (downloadVersionManually.equals("latest")) { - downloadFile(latestVersion, pluginFileName); - }else{ - downloadFile(downloadVersionManually, pluginFileName); - } + if(downloadVersionManually == null) { return; } + if (downloadVersionManually.equals("latest")) { + downloadFile(latestVersion, pluginFileName); + }else{ + downloadFile(downloadVersionManually, pluginFileName); + } + if(latestVersion.equals(thisVersion) || thisVersion.contains("-")){ //no need to update or running custom version return; } - if (Objects.requireNonNull(plugin.config.getString("updater.auto-update")).equalsIgnoreCase("false")) { - //return if auto-update is false - return; - } if(thisVersion.split("\\.")[1].equals(latestVersion.split("\\.")[1]) && thisVersion.split("\\.")[0].equals(latestVersion.split("\\.")[0])){ //only update if the latest version is a minor update //the first and second number of the version is the same, updates: [major.major.minor.minor]