Uses BSBConfig for settings.

This commit is contained in:
tastybento 2018-06-05 00:07:37 -07:00
parent 8b68cea6a1
commit 713b69216e
2 changed files with 4 additions and 15 deletions

View File

@ -11,9 +11,9 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffectType;
import us.tastybento.bskyblock.api.configuration.ConfigEntry;
import us.tastybento.bskyblock.api.configuration.ISettings;
import us.tastybento.bskyblock.api.configuration.StoreAt;
import us.tastybento.bskyblock.api.configuration.WorldSettings;
import us.tastybento.bskyblock.database.objects.DataObject;
import us.tastybento.bskyblock.database.objects.adapters.Adapter;
import us.tastybento.bskyblock.database.objects.adapters.PotionEffectListAdapter;
@ -23,7 +23,7 @@ import us.tastybento.bskyblock.database.objects.adapters.PotionEffectListAdapter
*
*/
@StoreAt(filename="config.yml", path="addons/BSkyBlock-AcidIsland") // Explicitly call out what name this should have.
public class AISettings implements ISettings<AISettings>, WorldSettings {
public class AISettings implements DataObject, WorldSettings {
private String uniqueId = "config";
@ -307,11 +307,6 @@ public class AISettings implements ISettings<AISettings>, WorldSettings {
return maxHomes;
}
@Override
public AISettings getInstance() {
return this;
}
@Override
public String getUniqueId() {
return uniqueId;

View File

@ -11,6 +11,7 @@ import bskyblock.addon.acidisland.listeners.LavaCheck;
import bskyblock.addon.acidisland.world.AcidIslandWorld;
import bskyblock.addon.acidisland.world.AcidTask;
import us.tastybento.bskyblock.api.addons.Addon;
import us.tastybento.bskyblock.api.configuration.BSBConfig;
/**
* Addon to BSkyBlock that enables AcidIsland
@ -26,14 +27,7 @@ public class AcidIsland extends Addon {
public void onLoad() {
saveDefaultConfig();
// Load settings
settings = new AISettings();
// Load settings from config.yml. This will check if there are any issues with it too.
try {
settings = settings.loadSettings();
} catch (Exception e) {
this.log("Settings could not be loaded " + e.getMessage());
e.printStackTrace();
}
settings = new BSBConfig<>(this, AISettings.class).loadConfigObject("");
// Create worlds
aiw = new AcidIslandWorld(this);
}