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: '{'
end: '}'
updater:
auto-update: false
update-checks: true
purchase:
currency:

View File

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

View File

@ -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.");
}

View File

@ -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 == null) {
return;
}
if (downloadVersionManually.equals("latest")) {
downloadFile(latestVersion, pluginFileName);
}else{
downloadFile(downloadVersionManually, pluginFileName);
}
return;
}
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]