forked from LogBlock/LogBlock
Limit query results
lookup.limesLimit is now correctly used as default limit for lookups The new lookup.hardLimesLimit is the max limit that is enforced in all lookups + rollbacks (default 100000) Fixes #636, Fixes #128
This commit is contained in:
@ -340,6 +340,7 @@ public class CommandsHandler implements CommandExecutor {
|
|||||||
final QueryParams params = new QueryParams(logblock);
|
final QueryParams params = new QueryParams(logblock);
|
||||||
params.since = defaultTime;
|
params.since = defaultTime;
|
||||||
params.bct = BlockChangeType.ALL;
|
params.bct = BlockChangeType.ALL;
|
||||||
|
params.limit = Config.linesLimit;
|
||||||
params.parseArgs(sender, argsList);
|
params.parseArgs(sender, argsList);
|
||||||
new CommandLookup(sender, params, true);
|
new CommandLookup(sender, params, true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -87,7 +87,10 @@ public final class QueryParams implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getLimit() {
|
public String getLimit() {
|
||||||
return limit > 0 ? "LIMIT " + limit : "";
|
if (Config.hardLinesLimit <= 0 || (limit > 0 && limit <= Config.hardLinesLimit)) {
|
||||||
|
return limit > 0 ? "LIMIT " + limit : "";
|
||||||
|
}
|
||||||
|
return "LIMIT " + Config.hardLinesLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getQuery() {
|
public String getQuery() {
|
||||||
|
@ -40,7 +40,7 @@ public class Config {
|
|||||||
public static Map<String, Tool> toolsByName;
|
public static Map<String, Tool> toolsByName;
|
||||||
public static Map<Material, Tool> toolsByType;
|
public static Map<Material, Tool> toolsByType;
|
||||||
public static int defaultDist, defaultTime;
|
public static int defaultDist, defaultTime;
|
||||||
public static int linesPerPage, linesLimit;
|
public static int linesPerPage, linesLimit, hardLinesLimit;
|
||||||
public static boolean askRollbacks, askRedos, askClearLogs, askClearLogAfterRollback, askRollbackAfterBan;
|
public static boolean askRollbacks, askRedos, askClearLogs, askClearLogAfterRollback, askRollbackAfterBan;
|
||||||
public static String banPermission;
|
public static String banPermission;
|
||||||
public static Set<Material> hiddenBlocks;
|
public static Set<Material> hiddenBlocks;
|
||||||
@ -102,6 +102,7 @@ public class Config {
|
|||||||
def.put("lookup.defaultTime", "30 minutes");
|
def.put("lookup.defaultTime", "30 minutes");
|
||||||
def.put("lookup.linesPerPage", 15);
|
def.put("lookup.linesPerPage", 15);
|
||||||
def.put("lookup.linesLimit", 1500);
|
def.put("lookup.linesLimit", 1500);
|
||||||
|
def.put("lookup.hardLinesLimit", 100000);
|
||||||
try {
|
try {
|
||||||
formatter = new SimpleDateFormat(config.getString("lookup.dateFormat", "MM-dd HH:mm:ss"));
|
formatter = new SimpleDateFormat(config.getString("lookup.dateFormat", "MM-dd HH:mm:ss"));
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
@ -207,6 +208,7 @@ public class Config {
|
|||||||
defaultTime = parseTimeSpec(config.getString("lookup.defaultTime").split(" "));
|
defaultTime = parseTimeSpec(config.getString("lookup.defaultTime").split(" "));
|
||||||
linesPerPage = config.getInt("lookup.linesPerPage", 15);
|
linesPerPage = config.getInt("lookup.linesPerPage", 15);
|
||||||
linesLimit = config.getInt("lookup.linesLimit", 1500);
|
linesLimit = config.getInt("lookup.linesLimit", 1500);
|
||||||
|
hardLinesLimit = config.getInt("lookup.hardLinesLimit", 100000);
|
||||||
askRollbacks = config.getBoolean("questioner.askRollbacks", true);
|
askRollbacks = config.getBoolean("questioner.askRollbacks", true);
|
||||||
askRedos = config.getBoolean("questioner.askRedos", true);
|
askRedos = config.getBoolean("questioner.askRedos", true);
|
||||||
askClearLogs = config.getBoolean("questioner.askClearLogs", true);
|
askClearLogs = config.getBoolean("questioner.askClearLogs", true);
|
||||||
|
Reference in New Issue
Block a user