From 3e8c3459f6eee26dbd26c80b9e454a2e8bc695c7 Mon Sep 17 00:00:00 2001 From: gravitylow Date: Mon, 14 Oct 2013 18:18:30 -0400 Subject: [PATCH] Fix database connection toggles --- .../java/net/gravitydevelopment/anticheat/AntiCheat.java | 5 ++++- .../anticheat/config/Configuration.java | 6 ++++-- .../anticheat/config/files/Enterprise.java | 8 ++++---- .../anticheat/util/enterprise/Database.java | 1 + 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/gravitydevelopment/anticheat/AntiCheat.java b/src/main/java/net/gravitydevelopment/anticheat/AntiCheat.java index 2acee55..c2262e1 100644 --- a/src/main/java/net/gravitydevelopment/anticheat/AntiCheat.java +++ b/src/main/java/net/gravitydevelopment/anticheat/AntiCheat.java @@ -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; + } } diff --git a/src/main/java/net/gravitydevelopment/anticheat/config/Configuration.java b/src/main/java/net/gravitydevelopment/anticheat/config/Configuration.java index c9b2a53..3f8b801 100644 --- a/src/main/java/net/gravitydevelopment/anticheat/config/Configuration.java +++ b/src/main/java/net/gravitydevelopment/anticheat/config/Configuration.java @@ -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(); // 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 { diff --git a/src/main/java/net/gravitydevelopment/anticheat/config/files/Enterprise.java b/src/main/java/net/gravitydevelopment/anticheat/config/files/Enterprise.java index 58d878d..7c3c8e4 100644 --- a/src/main/java/net/gravitydevelopment/anticheat/config/files/Enterprise.java +++ b/src/main/java/net/gravitydevelopment/anticheat/config/files/Enterprise.java @@ -33,9 +33,9 @@ public class Enterprise extends ConfigurationFile { public ConfigValue loggingLife; public ConfigValue loggingInterval; - public ConfigValue syncUsers; + public ConfigValue syncLevels; - public ConfigValue configEvents; + public ConfigValue configGroups ; public ConfigValue configRules; public Database database; @@ -52,9 +52,9 @@ public class Enterprise extends ConfigurationFile { loggingLife = new ConfigValue("log.life"); loggingInterval = new ConfigValue("log.interval"); - syncUsers = new ConfigValue("sync.users"); + syncLevels = new ConfigValue("sync.levels"); - configEvents = new ConfigValue("config.events"); + configGroups = new ConfigValue("config.groups"); configRules = new ConfigValue("config.rules"); ConfigValue databaseType = new ConfigValue("database.type"); diff --git a/src/main/java/net/gravitydevelopment/anticheat/util/enterprise/Database.java b/src/main/java/net/gravitydevelopment/anticheat/util/enterprise/Database.java index e1ac7cf..d394eef 100644 --- a/src/main/java/net/gravitydevelopment/anticheat/util/enterprise/Database.java +++ b/src/main/java/net/gravitydevelopment/anticheat/util/enterprise/Database.java @@ -139,6 +139,7 @@ public class Database { }, logInterval * 20, logInterval * 20); } + AntiCheat.getPlugin().verboseLog("Connected to the database."); } catch (SQLException e) { e.printStackTrace(); }