summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinenash <minenash@protonmail.com>2018-12-16 17:55:47 -0500
committerMinenash <minenash@protonmail.com>2018-12-16 17:55:47 -0500
commit2e6a514b5c3bc88cb86e3b60c7f3657651776ad7 (patch)
tree4386837c22e07d7b266204eadc381c72068889a4
parent7da2a0a87bb35f250204d831c660e7ed7fd24d48 (diff)
Fixed enabling when there's no config.
-rw-r--r--src/main/java/com/redstoner/modules/check/Check.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/main/java/com/redstoner/modules/check/Check.java b/src/main/java/com/redstoner/modules/check/Check.java
index b654869..4204c05 100644
--- a/src/main/java/com/redstoner/modules/check/Check.java
+++ b/src/main/java/com/redstoner/modules/check/Check.java
@@ -53,24 +53,27 @@ public class Check implements Module, Listener {
}
if (config == null || !config.containsKey("database") || !config.containsKey("table")) {
- getLogger().error("Could not load the Check config file, disabling, trying to write defaults!");
-
+ getLogger().warn("Could not load the Check config file, ip info for offline users and website data is unavaliable!");
+ noTableReason = "Could not load the config file";
+
config.put("database", "redstoner");
config.put("table", "users");
try {
config.save();
- } catch (IOException | NonSaveableConfigException e) {}
-
- noTableReason = "Could not load the config file";
+ getLogger().info("A default config file has been created for you.");
+ } catch (IOException | NonSaveableConfigException e) {
+ getLogger().error("A default config file was unable to be created.");
+ }
- return false;
+ return true;
}
try {
+ getLogger().info("Attempting to load the database and the table, this might take a few seconds.");
MysqlDatabase database = MysqlHandler.INSTANCE.getDatabase(config.get("database") + "?autoReconnect=true");
table = database.getTable(config.get("table"));
- } catch (NullPointerException e) {
+ } catch (Exception e) {
getLogger().warn("Could not use the Check config file, ip info for offline users and website data is unavaliable!");
noTableReason = "Could not use the config file";
}