From f1717d2deb8b091a36733260430978af338a5f55 Mon Sep 17 00:00:00 2001 From: rockyhawk64 Date: Thu, 28 Apr 2022 00:43:51 +1000 Subject: [PATCH] 3.17.4.1 --- resource/plugin.yml | 2 +- src/me/rockyhawk/commandpanels/CommandPanels.java | 14 ++++++++++---- .../rockyhawk/commandpanels/updater/Updater.java | 4 ++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/resource/plugin.yml b/resource/plugin.yml index 674ef84..d7effa5 100644 --- a/resource/plugin.yml +++ b/resource/plugin.yml @@ -1,4 +1,4 @@ -version: 3.17.4.0 +version: 3.17.4.1 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 a627862..73218a7 100644 --- a/src/me/rockyhawk/commandpanels/CommandPanels.java +++ b/src/me/rockyhawk/commandpanels/CommandPanels.java @@ -114,15 +114,17 @@ public class CommandPanels extends JavaPlugin{ public void onEnable() { Bukkit.getLogger().info("[CommandPanels] RockyHawk's CommandPanels v" + this.getDescription().getVersion() + " Plugin Loading..."); - //set version to latest version - updater.githubNewUpdate(false); - //register config files this.blockConfig = YamlConfiguration.loadConfiguration(new File(getDataFolder() + File.separator + "blocks.yml")); panelData.dataConfig = YamlConfiguration.loadConfiguration(new File(getDataFolder() + File.separator + "data.yml")); inventorySaver.inventoryConfig = YamlConfiguration.loadConfiguration(new File(getDataFolder() + File.separator + "inventories.yml")); this.config = YamlConfiguration.loadConfiguration(new File(this.getDataFolder() + File.separator + "config.yml")); + //set version to latest version + if (Objects.requireNonNull(this.config.getString("updater.update-checks")).equalsIgnoreCase("true")) { + updater.githubNewUpdate(false); + } + //save the config.yml file File configFile = new File(this.getDataFolder() + File.separator + "config.yml"); if (!configFile.exists()) { @@ -167,7 +169,6 @@ public class CommandPanels extends JavaPlugin{ Objects.requireNonNull(this.getCommand("commandpanelversion")).setExecutor(new Commandpanelversion(this)); Objects.requireNonNull(this.getCommand("commandpanellist")).setExecutor(new Commandpanelslist(this)); this.getServer().getPluginManager().registerEvents(new Utils(this), this); - this.getServer().getPluginManager().registerEvents(updater, this); this.getServer().getPluginManager().registerEvents(inventorySaver, this); this.getServer().getPluginManager().registerEvents(inputUtils, this); this.getServer().getPluginManager().registerEvents(new UtilsPanelsLoader(this), this); @@ -175,6 +176,11 @@ public class CommandPanels extends JavaPlugin{ this.getServer().getPluginManager().registerEvents(new ItemFallManager(this), this); this.getServer().getPluginManager().registerEvents(new OpenOnJoin(this), this); + //load in the updater if requested + if (Objects.requireNonNull(config.getString("updater.update-checks")).equalsIgnoreCase("true")) { + this.getServer().getPluginManager().registerEvents(updater, this); + } + //load in PlaceholderAPI Expansion if (this.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) { new CpPlaceholderExpansion(this).register(); diff --git a/src/me/rockyhawk/commandpanels/updater/Updater.java b/src/me/rockyhawk/commandpanels/updater/Updater.java index 607c44f..67c517e 100644 --- a/src/me/rockyhawk/commandpanels/updater/Updater.java +++ b/src/me/rockyhawk/commandpanels/updater/Updater.java @@ -103,6 +103,10 @@ public class Updater implements Listener { //the pluginFileName can only be obtained from the main class public void autoUpdatePlugin(String pluginFileName){ + if (Objects.requireNonNull(plugin.config.getString("updater.update-checks")).equalsIgnoreCase("true")) { + return; + } + String latestVersion = catchedLatestVersion; String thisVersion = plugin.getDescription().getVersion();