mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2025-01-23 21:51:31 +01:00
Add update channel config
This commit is contained in:
parent
d01f91edc9
commit
7cb27ffb15
@ -38,7 +38,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>at.pcgamingfreaks</groupId>
|
<groupId>at.pcgamingfreaks</groupId>
|
||||||
<artifactId>PluginLib</artifactId>
|
<artifactId>PluginLib</artifactId>
|
||||||
<version>1.0.24-SNAPSHOT</version>
|
<version>1.0.25-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- BadRabbit -->
|
<!-- BadRabbit -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -200,10 +200,12 @@ InventoryManagement:
|
|||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
Misc:
|
Misc:
|
||||||
# Enables/Disables the auto-update function of the plugin.
|
AutoUpdate:
|
||||||
AutoUpdate: true
|
# 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!
|
# Enable this option if you are using a BungeeCord setup!
|
||||||
UseBungeeCord: false
|
UseBungeeCord: false
|
||||||
|
|
||||||
# Config file version. Don't touch it!
|
# Config file version. Don't touch it!
|
||||||
Version: 28
|
Version: 29
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
public class Config extends Configuration implements DatabaseConnectionConfiguration
|
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)
|
public Config(JavaPlugin plugin)
|
||||||
{
|
{
|
||||||
@ -64,7 +64,10 @@ protected void doUpgrade(@NotNull YamlFileManager oldConfig)
|
|||||||
{
|
{
|
||||||
Map<String, String> remappedKeys = new HashMap<>();
|
Map<String, String> remappedKeys = new HashMap<>();
|
||||||
if(oldConfig.getVersion() <= 23) remappedKeys.put("ItemFilter.Materials", "ItemFilter.Blacklist");
|
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<String> 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()
|
public boolean isBungeeCordModeEnabled()
|
||||||
{
|
{
|
||||||
return getConfigE().getBoolean("Misc.UseBungeeCord", false);
|
return getConfigE().getBoolean("Misc.UseBungeeCord", false);
|
||||||
}
|
}
|
||||||
|
//endregion
|
||||||
|
|
||||||
public long getCommandCooldown()
|
public long getCommandCooldown()
|
||||||
{
|
{
|
||||||
|
@ -19,5 +19,5 @@
|
|||||||
|
|
||||||
public class MagicValues
|
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";
|
||||||
}
|
}
|
@ -137,7 +137,7 @@ public void onEnable()
|
|||||||
lang = new Language(this);
|
lang = new Language(this);
|
||||||
load();
|
load();
|
||||||
|
|
||||||
if(config.getAutoUpdate()) updater.update();
|
if(config.useUpdater()) updater.update();
|
||||||
getLogger().info(StringUtils.getPluginEnabledMessage(getDescription().getName()));
|
getLogger().info(StringUtils.getPluginEnabledMessage(getDescription().getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ public void onEnable()
|
|||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
if(config == null) return;
|
if(config == null) return;
|
||||||
if(config.getAutoUpdate()) updater.update();
|
if(config.useUpdater()) updater.update();
|
||||||
unload();
|
unload();
|
||||||
updater.waitForAsyncOperation(); // Wait for an update to finish
|
updater.waitForAsyncOperation(); // Wait for an update to finish
|
||||||
getLogger().info(StringUtils.getPluginDisabledMessage(getDescription().getName()));
|
getLogger().info(StringUtils.getPluginDisabledMessage(getDescription().getName()));
|
||||||
@ -159,6 +159,7 @@ public void update(final @Nullable UpdateResponseCallback updateResponseCallback
|
|||||||
|
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
|
updater.setChannel(config.getUpdateChannel());
|
||||||
lang.load(config);
|
lang.load(config);
|
||||||
database = Database.getDatabase(this);
|
database = Database.getDatabase(this);
|
||||||
if(database == null)
|
if(database == null)
|
||||||
|
2
pom.xml
2
pom.xml
@ -7,7 +7,7 @@
|
|||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<revision>2.3.7-RC1</revision>
|
<revision>2.3.7</revision>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
Loading…
Reference in New Issue
Block a user