Reused one config object.
This commit is contained in:
parent
77ca4668ac
commit
785e887881
|
@ -27,6 +27,7 @@ public class BSkyBlock extends GameModeAddon {
|
||||||
// Settings
|
// Settings
|
||||||
private Settings settings;
|
private Settings settings;
|
||||||
private ChunkGeneratorWorld chunkGenerator;
|
private ChunkGeneratorWorld chunkGenerator;
|
||||||
|
private Config<Settings> configObject = new Config<>(this, Settings.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
|
@ -43,7 +44,7 @@ public class BSkyBlock extends GameModeAddon {
|
||||||
|
|
||||||
private void loadSettings() {
|
private void loadSettings() {
|
||||||
// Load settings again to get worlds
|
// Load settings again to get worlds
|
||||||
settings = new Config<>(this, Settings.class).loadConfigObject();
|
settings = configObject.loadConfigObject();
|
||||||
if (settings == null) {
|
if (settings == null) {
|
||||||
// Disable
|
// Disable
|
||||||
logError("BSkyBlock settings could not load! Addon disabled.");
|
logError("BSkyBlock settings could not load! Addon disabled.");
|
||||||
|
@ -130,7 +131,7 @@ public class BSkyBlock extends GameModeAddon {
|
||||||
@Override
|
@Override
|
||||||
public void saveWorldSettings() {
|
public void saveWorldSettings() {
|
||||||
if (settings != null) {
|
if (settings != null) {
|
||||||
new Config<>(this, Settings.class).saveConfigObject(settings);
|
configObject.saveConfigObject(settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue