This commit is contained in:
rockyhawk64 2024-04-30 20:13:05 +10:00
parent 42dd8ee698
commit bb50313587
4 changed files with 10 additions and 14 deletions

View File

@ -48,7 +48,6 @@ placeholders:
start: '{' start: '{'
end: '}' end: '}'
updater: updater:
auto-update: false
update-checks: true update-checks: true
purchase: purchase:
currency: currency:

View File

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

View File

@ -283,7 +283,7 @@ public class CommandPanels extends JavaPlugin{
//save files //save files
panelData.saveDataFile(); panelData.saveDataFile();
inventorySaver.saveInventoryFile(); inventorySaver.saveInventoryFile();
updater.autoUpdatePlugin(this.getFile().getName()); updater.updatePlugin(this.getFile().getName());
Bukkit.getLogger().info("RockyHawk's CommandPanels Plugin Disabled, aww man."); Bukkit.getLogger().info("RockyHawk's CommandPanels Plugin Disabled, aww man.");
} }

View File

@ -104,7 +104,7 @@ public class Updater implements Listener {
} }
//the pluginFileName can only be obtained from the main class //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")) { if (Objects.requireNonNull(plugin.config.getString("updater.update-checks")).equalsIgnoreCase("false")) {
return; return;
} }
@ -113,23 +113,20 @@ public class Updater implements Listener {
String thisVersion = plugin.getDescription().getVersion(); String thisVersion = plugin.getDescription().getVersion();
//manual download, only if it was requested //manual download, only if it was requested
if(downloadVersionManually != null) { if(downloadVersionManually == null) {
return;
}
if (downloadVersionManually.equals("latest")) { if (downloadVersionManually.equals("latest")) {
downloadFile(latestVersion, pluginFileName); downloadFile(latestVersion, pluginFileName);
}else{ }else{
downloadFile(downloadVersionManually, pluginFileName); downloadFile(downloadVersionManually, pluginFileName);
} }
return;
}
if(latestVersion.equals(thisVersion) || thisVersion.contains("-")){ if(latestVersion.equals(thisVersion) || thisVersion.contains("-")){
//no need to update or running custom version //no need to update or running custom version
return; 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])){ 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 //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] //the first and second number of the version is the same, updates: [major.major.minor.minor]