From 45e785bd1fa7b101cf0c0248d4950f7453834ccb Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 12 Mar 2019 00:27:47 -0700 Subject: [PATCH] Rewiring SQL to the new config pt 2 --- .../gmail/nossr50/commands/database/MmoshowdbCommand.java | 4 ++-- src/main/java/com/gmail/nossr50/config/MainConfig.java | 1 - .../nossr50/config/hocon/database/ConfigCategoryMySQL.java | 1 - .../com/gmail/nossr50/database/DatabaseManagerFactory.java | 5 ++--- .../java/net/shatteredlands/shatt/backup/ZipLibrary.java | 3 +-- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/database/MmoshowdbCommand.java b/src/main/java/com/gmail/nossr50/commands/database/MmoshowdbCommand.java index 343a70bbf..660d59f4c 100644 --- a/src/main/java/com/gmail/nossr50/commands/database/MmoshowdbCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/database/MmoshowdbCommand.java @@ -1,8 +1,8 @@ package com.gmail.nossr50.commands.database; -import com.gmail.nossr50.config.MainConfig; import com.gmail.nossr50.database.DatabaseManagerFactory; import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.mcMMO; import com.google.common.collect.ImmutableList; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -22,7 +22,7 @@ public class MmoshowdbCommand implements TabExecutor { return true; } - sender.sendMessage(LocaleLoader.getString("Commands.mmoshowdb", (MainConfig.getInstance().getUseMySQL() ? "sql" : "flatfile"))); + sender.sendMessage(LocaleLoader.getString("Commands.mmoshowdb", (mcMMO.getMySQLConfigSettings().isMySQLEnabled() ? "sql" : "flatfile"))); return true; default: diff --git a/src/main/java/com/gmail/nossr50/config/MainConfig.java b/src/main/java/com/gmail/nossr50/config/MainConfig.java index eb677f2fa..356cfc57d 100644 --- a/src/main/java/com/gmail/nossr50/config/MainConfig.java +++ b/src/main/java/com/gmail/nossr50/config/MainConfig.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.config; -import com.gmail.nossr50.database.SQLDatabaseManager; import com.gmail.nossr50.datatypes.MobHealthbarType; import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; diff --git a/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryMySQL.java b/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryMySQL.java index 7a559821b..3ec40e561 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryMySQL.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/database/ConfigCategoryMySQL.java @@ -1,7 +1,6 @@ package com.gmail.nossr50.config.hocon.database; import com.gmail.nossr50.database.SQLDatabaseManager; -import com.gmail.nossr50.mcMMO; import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; diff --git a/src/main/java/com/gmail/nossr50/database/DatabaseManagerFactory.java b/src/main/java/com/gmail/nossr50/database/DatabaseManagerFactory.java index 2df500fc6..3b47662cb 100644 --- a/src/main/java/com/gmail/nossr50/database/DatabaseManagerFactory.java +++ b/src/main/java/com/gmail/nossr50/database/DatabaseManagerFactory.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.database; -import com.gmail.nossr50.config.MainConfig; import com.gmail.nossr50.datatypes.database.DatabaseType; import com.gmail.nossr50.mcMMO; @@ -20,10 +19,10 @@ public class DatabaseManagerFactory { mcMMO.p.debug("Failed to create custom database manager"); e.printStackTrace(); } - mcMMO.p.debug("Falling back on " + (MainConfig.getInstance().getUseMySQL() ? "SQL" : "Flatfile") + " database"); + mcMMO.p.debug("Falling back on " + (mcMMO.getMySQLConfigSettings().isMySQLEnabled() ? "SQL" : "Flatfile") + " database"); } - return MainConfig.getInstance().getUseMySQL() ? new SQLDatabaseManager() : new FlatfileDatabaseManager(); + return mcMMO.getMySQLConfigSettings().isMySQLEnabled() ? new SQLDatabaseManager() : new FlatfileDatabaseManager(); } /** diff --git a/src/main/java/net/shatteredlands/shatt/backup/ZipLibrary.java b/src/main/java/net/shatteredlands/shatt/backup/ZipLibrary.java index 10e298ea3..f8f49c453 100644 --- a/src/main/java/net/shatteredlands/shatt/backup/ZipLibrary.java +++ b/src/main/java/net/shatteredlands/shatt/backup/ZipLibrary.java @@ -1,6 +1,5 @@ package net.shatteredlands.shatt.backup; -import com.gmail.nossr50.config.MainConfig; import com.gmail.nossr50.mcMMO; import java.io.File; @@ -27,7 +26,7 @@ public class ZipLibrary { private static File REPAIR_FILE = new File(mcMMO.getMainDirectory() + "repair.vanilla.yml");*/ public static void mcMMOBackup() throws IOException { - if (MainConfig.getInstance().getUseMySQL()) { + if (mcMMO.getMySQLConfigSettings().isMySQLEnabled()) { mcMMO.p.debug("This server is running in SQL Mode."); mcMMO.p.debug("Only config files will be backed up."); }