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