mirror of
https://github.com/BentoBoxWorld/CaveBlock.git
synced 2024-11-29 12:45:10 +01:00
Use common object for settings load/save
Config saving is now async so concurrent config objects should not be used.
This commit is contained in:
parent
07574dadfd
commit
6b51620028
2
pom.xml
2
pom.xml
@ -50,7 +50,7 @@
|
||||
<!-- Revision variable removes warning about dynamic version -->
|
||||
<revision>${build.version}-SNAPSHOT</revision>
|
||||
<!-- This allows to change between versions and snapshots. -->
|
||||
<build.version>1.6.0</build.version>
|
||||
<build.version>1.6.1</build.version>
|
||||
<build.number>-LOCAL</build.number>
|
||||
</properties>
|
||||
|
||||
|
@ -20,6 +20,7 @@ import world.bentobox.caveblock.listeners.CustomHeightLimitations;
|
||||
|
||||
public class CaveBlock extends GameModeAddon
|
||||
{
|
||||
|
||||
/**
|
||||
* Executes code when loading the addon. This is called before {@link #onEnable()}. This should preferably
|
||||
* be used to setup configuration and worlds.
|
||||
@ -84,7 +85,7 @@ public class CaveBlock extends GameModeAddon
|
||||
*/
|
||||
private void loadSettings()
|
||||
{
|
||||
this.settings = new Config<>(this, Settings.class).loadConfigObject();
|
||||
this.settings = settingsConfig.loadConfigObject();
|
||||
|
||||
if (this.settings == null)
|
||||
{
|
||||
@ -217,7 +218,7 @@ public class CaveBlock extends GameModeAddon
|
||||
{
|
||||
if (this.settings != null)
|
||||
{
|
||||
new Config<>(this, Settings.class).saveConfigObject(this.settings);
|
||||
settingsConfig.saveConfigObject(this.settings);
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,6 +227,10 @@ public class CaveBlock extends GameModeAddon
|
||||
// Section: Variables
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Config object
|
||||
*/
|
||||
private final Config<Settings> settingsConfig = new Config<>(this, Settings.class);
|
||||
|
||||
/**
|
||||
* This stores CaveBlock addon settings.
|
||||
@ -264,4 +269,5 @@ public class CaveBlock extends GameModeAddon
|
||||
*/
|
||||
private static final String THE_END = "_the_end";
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user