Fix database connection toggles

This commit is contained in:
gravitylow committed 2013-10-14 18:18:30 -04:00
1 parent bd2fd0952f
commit 3e8c3459f6
4 files changed
+13 -7

No files matched your search

@@ -152,7 +152,6 @@ public class AntiCheat extends JavaPlugin {
private void setupConfig() {
config = manager.getConfiguration();
verbose = config.getConfig().verboseStartup.getValue();
verboseLog("Setup the config.");
}
@@ -226,4 +225,8 @@ public class AntiCheat extends JavaPlugin {
getLogger().info(string);
}
}
public void setVerbose(boolean b) {
verbose = b;
}
}
@@ -52,6 +52,8 @@ public class Configuration {
public Configuration(AntiCheat plugin) {
config = new Config(plugin, this);
plugin.setVerbose(config.verboseStartup.getValue());
// Now load others
enterprise = new Enterprise(plugin, this);
lang = new Lang(plugin, this);
magic = new Magic(plugin, this);
@@ -66,7 +68,7 @@ public class Configuration {
dbfiles = new ArrayList<ConfigurationTable>();
// The following values can be configuration from a database, or from flatfile.
if (config.enterprise.getValue() && enterprise.configEvents.getValue()) {
if (config.enterprise.getValue() && enterprise.configGroups.getValue()) {
groups = new MySQLGroupsHolder(this);
dbfiles.add((MySQLGroupsHolder) groups);
} else {
@@ -82,7 +84,7 @@ public class Configuration {
flatfiles.add((YamlRulesHolder) rules);
}
if (config.enterprise.getValue() && enterprise.configEvents.getValue()) {
if (config.enterprise.getValue() && enterprise.syncLevels.getValue()) {
levels = new MySQLLevelsHolder(this);
dbfiles.add((MySQLLevelsHolder) levels);
} else {
@@ -33,9 +33,9 @@ public class Enterprise extends ConfigurationFile {
public ConfigValue<String> loggingLife;
public ConfigValue<String> loggingInterval;
public ConfigValue<Boolean> syncUsers;
public ConfigValue<Boolean> syncLevels;
public ConfigValue<Boolean> configEvents;
public ConfigValue<Boolean> configGroups ;
public ConfigValue<Boolean> configRules;
public Database database;
@@ -52,9 +52,9 @@ public class Enterprise extends ConfigurationFile {
loggingLife = new ConfigValue<String>("log.life");
loggingInterval = new ConfigValue<String>("log.interval");
syncUsers = new ConfigValue<Boolean>("sync.users");
syncLevels = new ConfigValue<Boolean>("sync.levels");
configEvents = new ConfigValue<Boolean>("config.events");
configGroups = new ConfigValue<Boolean>("config.groups");
configRules = new ConfigValue<Boolean>("config.rules");
ConfigValue<String> databaseType = new ConfigValue<String>("database.type");
@@ -139,6 +139,7 @@ public class Database {
}, logInterval * 20, logInterval * 20);
}
AntiCheat.getPlugin().verboseLog("Connected to the database.");
} catch (SQLException e) {
e.printStackTrace();
}