forked from LogBlock/LogBlock
@ -556,6 +556,10 @@ public final class QueryParams implements Cloneable {
|
||||
}
|
||||
|
||||
public void parseArgs(CommandSender sender, List<String> args) throws IllegalArgumentException {
|
||||
parseArgs(sender, args, true);
|
||||
}
|
||||
|
||||
public void parseArgs(CommandSender sender, List<String> args, boolean validate) throws IllegalArgumentException {
|
||||
if (args == null || args.isEmpty()) {
|
||||
throw new IllegalArgumentException("No parameters specified.");
|
||||
}
|
||||
@ -775,6 +779,15 @@ public final class QueryParams implements Cloneable {
|
||||
}
|
||||
i += values.length;
|
||||
}
|
||||
if (validate) {
|
||||
validate();
|
||||
}
|
||||
if (session != null) {
|
||||
session.lastQuery = clone();
|
||||
}
|
||||
}
|
||||
|
||||
public void validate() {
|
||||
if (bct == BlockChangeType.KILLS) {
|
||||
if (world == null) {
|
||||
throw new IllegalArgumentException("No world specified");
|
||||
@ -794,9 +807,6 @@ public final class QueryParams implements Cloneable {
|
||||
if (bct == BlockChangeType.CHAT && !Config.isLogging(Logging.CHAT)) {
|
||||
throw new IllegalArgumentException("Chat is not logged");
|
||||
}
|
||||
if (session != null) {
|
||||
session.lastQuery = clone();
|
||||
}
|
||||
}
|
||||
|
||||
public void setLocation(Location loc) {
|
||||
|
@ -228,7 +228,7 @@ public class Config {
|
||||
final boolean canDrop = tSec.getBoolean("canDrop", false);
|
||||
final QueryParams params = new QueryParams(logblock);
|
||||
params.prepareToolQuery = true;
|
||||
params.parseArgs(getConsoleSender(), Arrays.asList(tSec.getString("params").split(" ")));
|
||||
params.parseArgs(getConsoleSender(), Arrays.asList(tSec.getString("params").split(" ")), false);
|
||||
final ToolMode mode = ToolMode.valueOf(tSec.getString("mode").toUpperCase());
|
||||
final PermissionDefault pdef = PermissionDefault.valueOf(tSec.getString("permissionDefault").toUpperCase());
|
||||
tools.add(new Tool(toolName, aliases, leftClickBehavior, rightClickBehavior, defaultEnabled, item, canDrop, params, mode, pdef));
|
||||
|
@ -69,6 +69,7 @@ public class ToolListener implements Listener {
|
||||
}
|
||||
}
|
||||
try {
|
||||
params.validate();
|
||||
if (toolData.mode == ToolMode.ROLLBACK) {
|
||||
handler.new CommandRollback(player, params, true);
|
||||
} else if (toolData.mode == ToolMode.REDO) {
|
||||
|
Reference in New Issue
Block a user