diff --git a/Minepacks/pom.xml b/Minepacks/pom.xml index b242d8c..ada6548 100644 --- a/Minepacks/pom.xml +++ b/Minepacks/pom.xml @@ -38,7 +38,7 @@ at.pcgamingfreaks PluginLib - 1.0.24-SNAPSHOT + 1.0.25-SNAPSHOT diff --git a/Minepacks/resources/config.yml b/Minepacks/resources/config.yml index bbb9a20..07a3b63 100644 --- a/Minepacks/resources/config.yml +++ b/Minepacks/resources/config.yml @@ -200,10 +200,12 @@ InventoryManagement: Enabled: true Misc: - # Enables/Disables the auto-update function of the plugin. - AutoUpdate: true + AutoUpdate: + # When auto update is disabled you still can use the build in update function manually with /backpack update + Enabled: true + Channel: ${updateChannel} # Enable this option if you are using a BungeeCord setup! UseBungeeCord: false # Config file version. Don't touch it! -Version: 28 \ No newline at end of file +Version: 29 \ No newline at end of file diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Config.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Config.java index 8ae99ef..eff9cd6 100644 --- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Config.java +++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Config.java @@ -38,7 +38,7 @@ public class Config extends Configuration implements DatabaseConnectionConfiguration { - private static final int CONFIG_VERSION = 28, UPGRADE_THRESHOLD = CONFIG_VERSION, PRE_V2_VERSION = 20; + private static final int CONFIG_VERSION = 29, UPGRADE_THRESHOLD = CONFIG_VERSION, PRE_V2_VERSION = 20; public Config(JavaPlugin plugin) { @@ -64,7 +64,10 @@ protected void doUpgrade(@NotNull YamlFileManager oldConfig) { Map remappedKeys = new HashMap<>(); if(oldConfig.getVersion() <= 23) remappedKeys.put("ItemFilter.Materials", "ItemFilter.Blacklist"); - doUpgrade(oldConfig, remappedKeys); + if(oldConfig.getVersion() <= 28) remappedKeys.put("Misc.AutoUpdate.Enabled", "Misc.AutoUpdate"); + Collection keysToKeep = oldConfig.getYamlE().getKeysFiltered("Database\\.SQL\\.(MaxLifetime|IdleTimeout)"); + keysToKeep.addAll(oldConfig.getYamlE().getKeysFiltered("Database\\.Tables\\.Fields\\..+")); + doUpgrade(oldConfig, remappedKeys, keysToKeep); } } @@ -185,15 +188,28 @@ public ShrinkApproach getShrinkApproach() } } - public boolean getAutoUpdate() + //region Misc getters + public boolean useUpdater() { - return getConfigE().getBoolean("Misc.AutoUpdate", true); + return getConfigE().getBoolean("Misc.AutoUpdate.Enabled", getConfigE().getBoolean("Misc.AutoUpdate", true)); + } + + public String getUpdateChannel() + { + String channel = getConfigE().getString("Misc.AutoUpdate.Channel", "Release"); + if("Release".equals(channel) || "Master".equals(channel) || "Dev".equals(channel)) + { + return channel; + } + else logger.info("Unknown update Channel: " + channel); + return null; } public boolean isBungeeCordModeEnabled() { return getConfigE().getBoolean("Misc.UseBungeeCord", false); } + //endregion public long getCommandCooldown() { diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/MagicValues.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/MagicValues.java index a603c2e..4301389 100644 --- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/MagicValues.java +++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/MagicValues.java @@ -19,5 +19,5 @@ public class MagicValues { - public static final String MIN_PCGF_PLUGIN_LIB_VERSION = "1.0.24-SNAPSHOT"; + public static final String MIN_PCGF_PLUGIN_LIB_VERSION = "1.0.25-SNAPSHOT"; } \ No newline at end of file diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java index 7f6a6de..e600149 100644 --- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java +++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java @@ -137,7 +137,7 @@ public void onEnable() lang = new Language(this); load(); - if(config.getAutoUpdate()) updater.update(); + if(config.useUpdater()) updater.update(); getLogger().info(StringUtils.getPluginEnabledMessage(getDescription().getName())); } @@ -145,7 +145,7 @@ public void onEnable() public void onDisable() { if(config == null) return; - if(config.getAutoUpdate()) updater.update(); + if(config.useUpdater()) updater.update(); unload(); updater.waitForAsyncOperation(); // Wait for an update to finish getLogger().info(StringUtils.getPluginDisabledMessage(getDescription().getName())); @@ -159,6 +159,7 @@ public void update(final @Nullable UpdateResponseCallback updateResponseCallback private void load() { + updater.setChannel(config.getUpdateChannel()); lang.load(config); database = Database.getDatabase(this); if(database == null) diff --git a/pom.xml b/pom.xml index 04635df..b3b8ac1 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ pom - 2.3.7-RC1 + 2.3.7 UTF-8 UTF-8