Skip to content

Commit 5a120a0

Browse files
Fix dbPrefix not handling none when using convert command
1 parent 6991a2b commit 5a120a0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_Convert.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ public void onCommand(@NotNull ConsoleCommandSender sender, @NotNull String comm
8686
String port = dbCfg.getString("port");
8787
String databaseStr = dbCfg.getString("database");
8888
boolean useSSL = dbCfg.getBoolean("usessl");
89-
String prefix = dbCfg.getString("prefix", "");
89+
String prefix = dbCfg.getString("prefix");
90+
if (prefix == null || "none".equals(prefix)) {
91+
prefix = "";
92+
}
9093
Map<String, String> optionsMap = new HashMap<>();
9194
for (String options : dbCfg.getStringList("mysql-connect-options")) {
9295
String[] strings = options.split("=", 2);
@@ -95,9 +98,10 @@ public void onCommand(@NotNull ConsoleCommandSender sender, @NotNull String comm
9598
}
9699
}
97100
running = true;
101+
final String finalPrefix = prefix;
98102
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, () -> {
99103
try {
100-
AbstractDatabaseCore dbCore = new MySQLCore(plugin, Objects.requireNonNull(host, "MySQL host can't be null"), Objects.requireNonNull(user, "MySQL username can't be null"), Objects.requireNonNull(pass, "MySQL password can't be null"), Objects.requireNonNull(databaseStr, "MySQL database name can't be null"), Objects.requireNonNull(port, "MySQL port can't be null"), prefix, useSSL, optionsMap);
104+
AbstractDatabaseCore dbCore = new MySQLCore(plugin, Objects.requireNonNull(host, "MySQL host can't be null"), Objects.requireNonNull(user, "MySQL username can't be null"), Objects.requireNonNull(pass, "MySQL password can't be null"), Objects.requireNonNull(databaseStr, "MySQL database name can't be null"), Objects.requireNonNull(port, "MySQL port can't be null"), finalPrefix, useSSL, optionsMap);
101105
DatabaseManager databaseManager = new DatabaseManager(QuickShop.getInstance(), dbCore);
102106
sender.sendMessage(ChatColor.GREEN + "Converting...");
103107
transferShops(new SimpleDatabaseHelper(plugin, databaseManager), sender);

0 commit comments

Comments
 (0)