Handle db command args sanely

This commit is contained in:
NotMyFault 2021-07-21 15:55:26 +02:00
parent 6d71e0f8be
commit a0557112a1
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C

View File

@ -215,6 +215,7 @@ public class DatabaseCommand extends SubCommand {
if (args.length < 6) { if (args.length < 6) {
player.sendMessage(StaticCaption.of( player.sendMessage(StaticCaption.of(
"/plot database mysql [host] [port] [username] [password] [database] {prefix}")); "/plot database mysql [host] [port] [username] [password] [database] {prefix}"));
return false;
} }
String host = args[1]; String host = args[1];
String port = args[2]; String port = args[2];
@ -229,6 +230,7 @@ public class DatabaseCommand extends SubCommand {
case "sqlite" -> { case "sqlite" -> {
if (args.length < 2) { if (args.length < 2) {
player.sendMessage(StaticCaption.of("/plot database sqlite [file]")); player.sendMessage(StaticCaption.of("/plot database sqlite [file]"));
return false;
} }
File sqliteFile = File sqliteFile =
FileUtils.getFile(PlotSquared.platform().getDirectory(), args[1] + ".db"); FileUtils.getFile(PlotSquared.platform().getDirectory(), args[1] + ".db");