forked from LogBlock/LogBlock
New param "nocache" to prevent replacing the lookup cache (useful for tools)
This commit is contained in:
@ -97,6 +97,7 @@ public class CommandsHandler implements CommandExecutor {
|
||||
sender.sendMessage(ChatColor.GOLD + "sum [none|blocks|players] -- Sums the result");
|
||||
sender.sendMessage(ChatColor.GOLD + "asc, desc -- Changes the order of the displayed log");
|
||||
sender.sendMessage(ChatColor.GOLD + "coords -- Shows coordinates for each block");
|
||||
sender.sendMessage(ChatColor.GOLD + "nocache -- Don't set the lookup cache");
|
||||
sender.sendMessage(ChatColor.GOLD + "silent -- Displays lesser messages");
|
||||
} else if (command.equals("permissions")) {
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + "You've got the following permissions:");
|
||||
@ -484,7 +485,9 @@ public class CommandsHandler implements CommandExecutor {
|
||||
while (rs.next()) {
|
||||
blockchanges.add(factory.getLookupCacheElement(rs));
|
||||
}
|
||||
getSession(sender).lookupCache = blockchanges.toArray(new LookupCacheElement[blockchanges.size()]);
|
||||
if (!params.noCache) {
|
||||
getSession(sender).lookupCache = blockchanges.toArray(new LookupCacheElement[blockchanges.size()]);
|
||||
}
|
||||
if (blockchanges.size() > linesPerPage) {
|
||||
sender.sendMessage(ChatColor.DARK_AQUA.toString() + blockchanges.size() + " changes found." + (blockchanges.size() == linesLimit ? " Use 'limit -1' to see all changes." : ""));
|
||||
}
|
||||
@ -498,7 +501,9 @@ public class CommandsHandler implements CommandExecutor {
|
||||
showPage(sender, 1);
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + "No results found.");
|
||||
getSession(sender).lookupCache = null;
|
||||
if (!params.noCache) {
|
||||
getSession(sender).lookupCache = null;
|
||||
}
|
||||
}
|
||||
} catch (final Exception ex) {
|
||||
if (logblock.isCompletelyEnabled() || !(ex instanceof SQLException)) {
|
||||
@ -702,7 +707,9 @@ public class CommandsHandler implements CommandExecutor {
|
||||
return;
|
||||
}
|
||||
editor.start();
|
||||
getSession(sender).lookupCache = editor.errors;
|
||||
if (!params.noCache) {
|
||||
getSession(sender).lookupCache = editor.errors;
|
||||
}
|
||||
sender.sendMessage(ChatColor.GREEN + "Rollback finished successfully (" + editor.getElapsedTime() + " ms, " + editor.getSuccesses() + "/" + changes + " blocks" + (editor.getErrors() > 0 ? ", " + ChatColor.RED + editor.getErrors() + " errors" + ChatColor.GREEN : "") + (editor.getBlacklistCollisions() > 0 ? ", " + editor.getBlacklistCollisions() + " blacklist collisions" : "") + ")");
|
||||
if (!params.silent && askClearLogAfterRollback && logblock.hasPermission(sender, "logblock.clearlog") && sender instanceof Player) {
|
||||
Thread.sleep(1000);
|
||||
|
@ -51,6 +51,7 @@ public final class QueryParams implements Cloneable {
|
||||
keywords.put("victim", 1);
|
||||
keywords.put("both", 0);
|
||||
keywords.put("force", 0);
|
||||
keywords.put("nocache", 0);
|
||||
}
|
||||
public BlockChangeType bct = BlockChangeType.BOTH;
|
||||
public int limit = -1, before = 0, since = 0, radius = -1;
|
||||
@ -60,7 +61,7 @@ public final class QueryParams implements Cloneable {
|
||||
public List<String> killers = new ArrayList<String>();
|
||||
public List<String> victims = new ArrayList<String>();
|
||||
public boolean excludePlayersMode = false, excludeKillersMode = false, excludeVictimsMode = false, excludeBlocksMode = false, prepareToolQuery = false, silent = false, noForcedLimit = false;
|
||||
public boolean forceReplace = false;
|
||||
public boolean forceReplace = false, noCache = false;
|
||||
public CuboidRegion sel = null;
|
||||
public SummarizationMode sum = SummarizationMode.NONE;
|
||||
public List<Material> types = new ArrayList<Material>();
|
||||
@ -806,6 +807,8 @@ public final class QueryParams implements Cloneable {
|
||||
silent = true;
|
||||
} else if (param.equals("force")) {
|
||||
forceReplace = true;
|
||||
} else if (param.equals("nocache")) {
|
||||
noCache = true;
|
||||
} else if (param.equals("search") || param.equals("match")) {
|
||||
if (values.length == 0) {
|
||||
throw new IllegalArgumentException("No arguments for '" + param + "'");
|
||||
@ -831,7 +834,7 @@ public final class QueryParams implements Cloneable {
|
||||
if (validate) {
|
||||
validate();
|
||||
}
|
||||
if (session != null) {
|
||||
if (session != null && !noCache) {
|
||||
session.lastQuery = clone();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user