This commit is contained in:
Telesphoreo 2020-10-28 19:54:23 -05:00
parent a2f7394c88
commit 072879ad33
2 changed files with 10 additions and 11 deletions

View File

@ -47,7 +47,7 @@ public class Plex extends JavaPlugin
{ {
plugin = this; plugin = this;
config = new MainConfig(this, "config.yml"); config = new MainConfig(this);
saveResource("database.db", false); saveResource("database.db", false);
@ -67,18 +67,18 @@ public class Plex extends JavaPlugin
public void onEnable() public void onEnable()
{ {
config.load(); config.load();
PlexLog.log("Loaded config.yml");
try { try
{
PlexUtils.testConnections(); PlexUtils.testConnections();
PlexLog.log("Connected to " + storageType.name().toUpperCase()); PlexLog.log("Connected to " + storageType.name().toUpperCase());
} catch (Exception e) }
catch (Exception e)
{ {
PlexLog.error("Failed to connect to " + storageType.name().toUpperCase()); PlexLog.error("Failed to connect to " + storageType.name().toUpperCase());
e.printStackTrace(); e.printStackTrace();
} }
if (storageType == StorageType.MONGO) if (storageType == StorageType.MONGO)
{ {
mongoPlayerData = new MongoPlayerData(); mongoPlayerData = new MongoPlayerData();
@ -95,7 +95,6 @@ public class Plex extends JavaPlugin
rankManager.generateDefaultRanks(); rankManager.generateDefaultRanks();
rankManager.importDefaultRanks(); rankManager.importDefaultRanks();
PlexLog.log("Rank Manager initialized"); PlexLog.log("Rank Manager initialized");
} }
@Override @Override

View File

@ -10,14 +10,14 @@ public class MainConfig extends YamlConfiguration
private final Plex plugin; private final Plex plugin;
private final File file; private final File file;
public MainConfig(Plex plugin, String configName) public MainConfig(Plex plugin)
{ {
this.plugin = plugin; this.plugin = plugin;
this.file = new File(plugin.getDataFolder(), configName); this.file = new File(plugin.getDataFolder(), "config.yml");
if (!file.exists()) if (!file.exists())
{ {
saveDefault(configName); saveDefault();
} }
} }
@ -45,8 +45,8 @@ public class MainConfig extends YamlConfiguration
} }
} }
private void saveDefault(String configName) private void saveDefault()
{ {
plugin.saveResource(configName, false); plugin.saveResource("config.yml", false);
} }
} }