This commit is contained in:
rockyhawk64 2022-04-28 00:43:51 +10:00
parent f35e96138d
commit f1717d2deb
3 changed files with 15 additions and 5 deletions

View File

@ -1,4 +1,4 @@
version: 3.17.4.0
version: 3.17.4.1
main: me.rockyhawk.commandpanels.CommandPanels
name: CommandPanels
author: RockyHawk

View File

@ -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();

View File

@ -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();