Add config option to enable console SQL commands

(disabled by default)
This commit is contained in:
Heliosares
2024-01-09 13:42:53 -05:00
parent 8c0d33184b
commit bfb8da97cd
2 changed files with 10 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ public class APConfig {
private boolean overrideCommands;
private boolean logIncrementalPosition;
private boolean disableVacuum;
private boolean consoleSQL;
private boolean sessionLogIP;
private boolean skipRowCount;
private KeyUtil key;
@@ -62,6 +63,7 @@ public class APConfig {
} else {
disableVacuum = config.getBoolean("disablevacuum", false);
}
consoleSQL = config.getBoolean("ConsoleSQLCommands", false);
if (config.getPlatform() == PlatformType.SPIGOT) {
overrideCommands = config.getBoolean("OverrideCommands");
inventoryOnWorldChange = config.getBoolean("Actions.inventory.WorldChange", false);
@@ -284,4 +286,8 @@ public class APConfig {
public boolean isSkipRowCount() {
return skipRowCount;
}
public boolean isConsoleSQL() {
return consoleSQL;
}
}

View File

@@ -23,6 +23,10 @@ public class SQLCommand extends Command {
@Override
public void onCommand(SenderAdapter sender, String commandLabel, String[] args) {
if (!plugin.getAPConfig().isConsoleSQL()) {
sender.sendMessageRaw("&cThis command must be enabled in the config by setting 'ConsoleSQLCommands: true'");
return;
}
StringBuilder msg = new StringBuilder();
for (int i = 1; i < args.length; i++) {
msg.append(args[i]).append(" ");