Added support for time ranges in the time parameter

This commit is contained in:
Intelli 2022-03-01 15:58:15 -07:00
parent a596dd66a9
commit 0bbeee65e8
11 changed files with 193 additions and 99 deletions

View file

@ -168,7 +168,6 @@ public class CoreProtectAPI extends Queue {
} }
public int APIVersion() { public int APIVersion() {
return 8;
try { try {
// deny access to BlocksHub to prevent duplicate data from being logged // deny access to BlocksHub to prevent duplicate data from being logged
if (!checkedBlocksHub && Bukkit.getPluginManager().getPlugin("BlocksHub") != null) { if (!checkedBlocksHub && Bukkit.getPluginManager().getPlugin("BlocksHub") != null) {
@ -187,6 +186,7 @@ public class CoreProtectAPI extends Queue {
// proceed with returning API version // proceed with returning API version
} }
return 8;
} }
public List<String[]> blockLookup(Block block, int time) { public List<String[]> blockLookup(Block block, int time) {
@ -483,7 +483,8 @@ public class CoreProtectAPI extends Queue {
} }
long timestamp = System.currentTimeMillis() / 1000L; long timestamp = System.currentTimeMillis() / 1000L;
long timePeriod = timestamp - time; long startTime = timestamp - time;
long endTime = 0;
if (radius < 1) { if (radius < 1) {
radius = -1; radius = -1;
@ -525,16 +526,16 @@ public class CoreProtectAPI extends Queue {
} }
if (useLimit) { if (useLimit) {
result = Lookup.performPartialLookup(statement, null, uuids, restrictUsers, restrictBlocks, excludeBlocks, excludeUsers, actionList, location, argRadius, null, timePeriod, offset, rowCount, restrictWorld, true); result = Lookup.performPartialLookup(statement, null, uuids, restrictUsers, restrictBlocks, excludeBlocks, excludeUsers, actionList, location, argRadius, null, startTime, endTime, offset, rowCount, restrictWorld, true);
} }
else { else {
result = Lookup.performLookup(statement, null, uuids, restrictUsers, restrictBlocks, excludeBlocks, excludeUsers, actionList, location, argRadius, timePeriod, restrictWorld, true); result = Lookup.performLookup(statement, null, uuids, restrictUsers, restrictBlocks, excludeBlocks, excludeUsers, actionList, location, argRadius, startTime, endTime, restrictWorld, true);
} }
} }
else { else {
if (!Bukkit.isPrimaryThread()) { if (!Bukkit.isPrimaryThread()) {
boolean verbose = false; boolean verbose = false;
result = Rollback.performRollbackRestore(statement, null, uuids, restrictUsers, null, restrictBlocks, excludeBlocks, excludeUsers, actionList, location, argRadius, timePeriod, restrictWorld, false, verbose, action, 0); result = Rollback.performRollbackRestore(statement, null, uuids, restrictUsers, null, restrictBlocks, excludeBlocks, excludeUsers, actionList, location, argRadius, startTime, endTime, restrictWorld, false, verbose, action, 0);
} }
} }

View file

@ -17,9 +17,10 @@ public class ApplyCommand {
try { try {
if (ConfigHandler.lastRollback.get(user.getName()) != null) { if (ConfigHandler.lastRollback.get(user.getName()) != null) {
List<Object> list = ConfigHandler.lastRollback.get(user.getName()); List<Object> list = ConfigHandler.lastRollback.get(user.getName());
long time = (Long) list.get(0); long startTime = (Long) list.get(0);
args = (String[]) list.get(1); long endTime = (Long) list.get(1);
Location location = (Location) list.get(2); args = (String[]) list.get(2);
Location location = (Location) list.get(3);
boolean valid = false; boolean valid = false;
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
if (args[i].equals("#preview")) { if (args[i].equals("#preview")) {
@ -32,7 +33,7 @@ public class ApplyCommand {
} }
else { else {
ConfigHandler.lastRollback.remove(user.getName()); ConfigHandler.lastRollback.remove(user.getName());
RollbackRestoreCommand.runCommand(user, command, permission, args, location, time); RollbackRestoreCommand.runCommand(user, command, permission, args, location, startTime, endTime);
} }
} }
else { else {

View file

@ -17,9 +17,10 @@ public class CancelCommand {
try { try {
if (ConfigHandler.lastRollback.get(user.getName()) != null) { if (ConfigHandler.lastRollback.get(user.getName()) != null) {
List<Object> list = ConfigHandler.lastRollback.get(user.getName()); List<Object> list = ConfigHandler.lastRollback.get(user.getName());
long time = (Long) list.get(0); long startTime = (Long) list.get(0);
args = (String[]) list.get(1); long endTime = (Long) list.get(1);
Location location = (Location) list.get(2); args = (String[]) list.get(2);
Location location = (Location) list.get(3);
boolean valid = false; boolean valid = false;
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
if (args[i].equals("#preview")) { if (args[i].equals("#preview")) {
@ -32,7 +33,7 @@ public class CancelCommand {
} }
else { else {
ConfigHandler.lastRollback.remove(user.getName()); ConfigHandler.lastRollback.remove(user.getName());
RollbackRestoreCommand.runCommand(user, command, permission, args, location, time); RollbackRestoreCommand.runCommand(user, command, permission, args, location, startTime, endTime);
} }
} }
else { else {

View file

@ -691,11 +691,13 @@ public class CommandHandler implements CommandExecutor {
return restricted; return restricted;
} }
protected static long parseTime(String[] inputArguments) { protected static long[] parseTime(String[] inputArguments) {
String[] argumentArray = inputArguments.clone(); String[] argumentArray = inputArguments.clone();
long time = 0; long timeStart = 0;
long timeEnd = 0;
int count = 0; int count = 0;
int next = 0; int next = 0;
boolean range = false;
double w = 0; double w = 0;
double d = 0; double d = 0;
double h = 0; double h = 0;
@ -720,41 +722,59 @@ public class CommandHandler implements CommandExecutor {
argument = argument.replaceAll("d", "d:"); argument = argument.replaceAll("d", "d:");
argument = argument.replaceAll("h", "h:"); argument = argument.replaceAll("h", "h:");
argument = argument.replaceAll("s", "s:"); argument = argument.replaceAll("s", "s:");
range = argument.contains("-");
int argCount = 0;
String[] i2 = argument.split(":"); String[] i2 = argument.split(":");
for (String i3 : i2) { for (String i3 : i2) {
if (i3.endsWith("w")) { if (range && argCount > 0 && timeStart == 0 && i3.startsWith("-")) {
timeStart = (long) (((w * 7 * 24 * 60 * 60) + (d * 24 * 60 * 60) + (h * 60 * 60) + (m * 60) + s));
w = 0;
d = 0;
h = 0;
m = 0;
s = 0;
}
if (i3.endsWith("w") && w == 0) {
String i4 = i3.replaceAll("[^0-9.]", ""); String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) { if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
w = Double.parseDouble(i4); w = Double.parseDouble(i4);
} }
} }
else if (i3.endsWith("d")) { else if (i3.endsWith("d") && d == 0) {
String i4 = i3.replaceAll("[^0-9.]", ""); String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) { if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
d = Double.parseDouble(i4); d = Double.parseDouble(i4);
} }
} }
else if (i3.endsWith("h")) { else if (i3.endsWith("h") && h == 0) {
String i4 = i3.replaceAll("[^0-9.]", ""); String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) { if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
h = Double.parseDouble(i4); h = Double.parseDouble(i4);
} }
} }
else if (i3.endsWith("m")) { else if (i3.endsWith("m") && m == 0) {
String i4 = i3.replaceAll("[^0-9.]", ""); String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) { if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
m = Double.parseDouble(i4); m = Double.parseDouble(i4);
} }
} }
else if (i3.endsWith("s")) { else if (i3.endsWith("s") && s == 0) {
String i4 = i3.replaceAll("[^0-9.]", ""); String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) { if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
s = Double.parseDouble(i4); s = Double.parseDouble(i4);
} }
} }
argCount++;
}
if (timeStart > 0) {
timeEnd = (long) (((w * 7 * 24 * 60 * 60) + (d * 24 * 60 * 60) + (h * 60 * 60) + (m * 60) + s));
}
else {
timeStart = (long) (((w * 7 * 24 * 60 * 60) + (d * 24 * 60 * 60) + (h * 60 * 60) + (m * 60) + s));
} }
double rs = ((w * 7 * 24 * 60 * 60) + (d * 24 * 60 * 60) + (h * 60 * 60) + (m * 60) + s);
time = (long) rs;
next = 0; next = 0;
} }
else { else {
@ -764,7 +784,12 @@ public class CommandHandler implements CommandExecutor {
count++; count++;
} }
return time; if (timeEnd >= timeStart) {
return new long[] { timeEnd, timeStart };
}
else {
return new long[] { timeStart, timeEnd };
}
} }
private static String timeString(BigDecimal input) { private static String timeString(BigDecimal input) {
@ -776,6 +801,7 @@ public class CommandHandler implements CommandExecutor {
String time = ""; String time = "";
int count = 0; int count = 0;
int next = 0; int next = 0;
boolean range = false;
BigDecimal w = new BigDecimal(0); BigDecimal w = new BigDecimal(0);
BigDecimal d = new BigDecimal(0); BigDecimal d = new BigDecimal(0);
BigDecimal h = new BigDecimal(0); BigDecimal h = new BigDecimal(0);
@ -800,44 +826,83 @@ public class CommandHandler implements CommandExecutor {
argument = argument.replaceAll("d", "d:"); argument = argument.replaceAll("d", "d:");
argument = argument.replaceAll("h", "h:"); argument = argument.replaceAll("h", "h:");
argument = argument.replaceAll("s", "s:"); argument = argument.replaceAll("s", "s:");
range = argument.contains("-");
int argCount = 0;
String[] i2 = argument.split(":"); String[] i2 = argument.split(":");
for (String i3 : i2) { for (String i3 : i2) {
if (i3.endsWith("w")) { if (range && argCount > 0 && !time.contains("-") && i3.startsWith("-")) {
w = new BigDecimal(0);
d = new BigDecimal(0);
h = new BigDecimal(0);
m = new BigDecimal(0);
s = new BigDecimal(0);
time = time + " -";
}
if (i3.endsWith("w") && w.intValue() == 0) {
String i4 = i3.replaceAll("[^0-9.]", ""); String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) { if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
w = new BigDecimal(i4); w = new BigDecimal(i4);
if (range) {
time = time + " " + timeString(w) + "w";
}
else {
time = time + " " + Phrase.build(Phrase.TIME_WEEKS, timeString(w), (w.doubleValue() == 1 ? Selector.FIRST : Selector.SECOND)); time = time + " " + Phrase.build(Phrase.TIME_WEEKS, timeString(w), (w.doubleValue() == 1 ? Selector.FIRST : Selector.SECOND));
} }
} }
else if (i3.endsWith("d")) { }
else if (i3.endsWith("d") && d.intValue() == 0) {
String i4 = i3.replaceAll("[^0-9.]", ""); String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) { if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
d = new BigDecimal(i4); d = new BigDecimal(i4);
if (range) {
time = time + " " + timeString(d) + "d";
}
else {
time = time + " " + Phrase.build(Phrase.TIME_DAYS, timeString(d), (d.doubleValue() == 1 ? Selector.FIRST : Selector.SECOND)); time = time + " " + Phrase.build(Phrase.TIME_DAYS, timeString(d), (d.doubleValue() == 1 ? Selector.FIRST : Selector.SECOND));
} }
} }
else if (i3.endsWith("h")) { }
else if (i3.endsWith("h") && h.intValue() == 0) {
String i4 = i3.replaceAll("[^0-9.]", ""); String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) { if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
h = new BigDecimal(i4); h = new BigDecimal(i4);
if (range) {
time = time + " " + timeString(h) + "h";
}
else {
time = time + " " + Phrase.build(Phrase.TIME_HOURS, timeString(h), (h.doubleValue() == 1 ? Selector.FIRST : Selector.SECOND)); time = time + " " + Phrase.build(Phrase.TIME_HOURS, timeString(h), (h.doubleValue() == 1 ? Selector.FIRST : Selector.SECOND));
} }
} }
else if (i3.endsWith("m")) { }
else if (i3.endsWith("m") && m.intValue() == 0) {
String i4 = i3.replaceAll("[^0-9.]", ""); String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) { if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
m = new BigDecimal(i4); m = new BigDecimal(i4);
if (range) {
time = time + " " + timeString(m) + "m";
}
else {
time = time + " " + Phrase.build(Phrase.TIME_MINUTES, timeString(m), (m.doubleValue() == 1 ? Selector.FIRST : Selector.SECOND)); time = time + " " + Phrase.build(Phrase.TIME_MINUTES, timeString(m), (m.doubleValue() == 1 ? Selector.FIRST : Selector.SECOND));
} }
} }
else if (i3.endsWith("s")) { }
else if (i3.endsWith("s") && s.intValue() == 0) {
String i4 = i3.replaceAll("[^0-9.]", ""); String i4 = i3.replaceAll("[^0-9.]", "");
if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) { if (i4.length() > 0 && i4.replaceAll("[^0-9]", "").length() > 0 && i4.indexOf('.') == i4.lastIndexOf('.')) {
s = new BigDecimal(i4); s = new BigDecimal(i4);
if (range) {
time = time + " " + timeString(s) + "s";
}
else {
time = time + " " + Phrase.build(Phrase.TIME_SECONDS, timeString(s), (s.doubleValue() == 1 ? Selector.FIRST : Selector.SECOND)); time = time + " " + Phrase.build(Phrase.TIME_SECONDS, timeString(s), (s.doubleValue() == 1 ? Selector.FIRST : Selector.SECOND));
} }
} }
} }
argCount++;
}
next = 0; next = 0;
} }
else { else {
@ -1128,7 +1193,7 @@ public class CommandHandler implements CommandExecutor {
} }
if (corecommand.equals("rollback") || corecommand.equals("restore") || corecommand.equals("rb") || corecommand.equals("rs") || corecommand.equals("ro") || corecommand.equals("re")) { if (corecommand.equals("rollback") || corecommand.equals("restore") || corecommand.equals("rb") || corecommand.equals("rs") || corecommand.equals("ro") || corecommand.equals("re")) {
RollbackRestoreCommand.runCommand(user, command, permission, argumentArray, null, 0); RollbackRestoreCommand.runCommand(user, command, permission, argumentArray, null, 0, 0);
} }
else if (corecommand.equals("apply")) { else if (corecommand.equals("apply")) {
ApplyCommand.runCommand(user, command, permission, argumentArray); ApplyCommand.runCommand(user, command, permission, argumentArray);

View file

@ -52,7 +52,9 @@ public class LookupCommand {
List<Object> argExclude = CommandHandler.parseExcluded(player, args, argAction); List<Object> argExclude = CommandHandler.parseExcluded(player, args, argAction);
List<String> argExcludeUsers = CommandHandler.parseExcludedUsers(player, args); List<String> argExcludeUsers = CommandHandler.parseExcludedUsers(player, args);
String ts = CommandHandler.parseTimeString(args); String ts = CommandHandler.parseTimeString(args);
long rbseconds = CommandHandler.parseTime(args); long[] argTime = CommandHandler.parseTime(args);
long startTime = argTime[0];
long endTime = argTime[1];
int argWid = CommandHandler.parseWorld(args, true, true); int argWid = CommandHandler.parseWorld(args, true, true);
int parseRows = CommandHandler.parseRows(args); int parseRows = CommandHandler.parseRows(args);
boolean count = CommandHandler.parseCount(args); boolean count = CommandHandler.parseCount(args);
@ -258,7 +260,7 @@ public class LookupCommand {
} }
} }
if (rbseconds <= 0 && !pageLookup && type == 4 && (argBlocks.size() > 0 || argUsers.size() > 0)) { if (startTime <= 0 && !pageLookup && type == 4 && (argBlocks.size() > 0 || argUsers.size() > 0)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_LOOKUP_TIME, Selector.FIRST)); Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_LOOKUP_TIME, Selector.FIRST));
return; return;
} }
@ -571,7 +573,8 @@ public class LookupCommand {
c++; c++;
} }
long cs = -1; long timeStart = -1;
long timeEnd = 0;
int x = 0; int x = 0;
int y = 0; int y = 0;
int z = 0; int z = 0;
@ -584,14 +587,14 @@ public class LookupCommand {
y = Integer.parseInt(data[1]); y = Integer.parseInt(data[1]);
z = Integer.parseInt(data[2]); z = Integer.parseInt(data[2]);
wid = Integer.parseInt(data[3]); wid = Integer.parseInt(data[3]);
cs = Long.parseLong(data[4]); timeStart = Long.parseLong(data[4]);
// arg_radius = Integer.parseInt(data[5]); timeEnd = Long.parseLong(data[5]);
argNoisy = Integer.parseInt(data[5]); argNoisy = Integer.parseInt(data[6]);
argExcluded = Integer.parseInt(data[6]); argExcluded = Integer.parseInt(data[7]);
argRestricted = Integer.parseInt(data[7]); argRestricted = Integer.parseInt(data[8]);
argWid = Integer.parseInt(data[8]); argWid = Integer.parseInt(data[9]);
if (defaultRe) { if (defaultRe) {
re = Integer.parseInt(data[9]); re = Integer.parseInt(data[10]);
} }
rollbackusers = ConfigHandler.lookupUlist.get(player.getName()); rollbackusers = ConfigHandler.lookupUlist.get(player.getName());
@ -601,7 +604,8 @@ public class LookupCommand {
argAction = ConfigHandler.lookupAlist.get(player.getName()); argAction = ConfigHandler.lookupAlist.get(player.getName());
argRadius = ConfigHandler.lookupRadius.get(player.getName()); argRadius = ConfigHandler.lookupRadius.get(player.getName());
ts = ConfigHandler.lookupTime.get(player.getName()); ts = ConfigHandler.lookupTime.get(player.getName());
rbseconds = 1; startTime = 1;
endTime = 0;
} }
else { else {
if (lo != null) { if (lo != null) {
@ -658,15 +662,23 @@ public class LookupCommand {
final List<String> rollbackusers2 = rollbackusers; final List<String> rollbackusers2 = rollbackusers;
long unixtimestamp = (System.currentTimeMillis() / 1000L); long unixtimestamp = (System.currentTimeMillis() / 1000L);
if (cs == -1) { if (timeStart == -1) {
if (rbseconds <= 0) { if (startTime <= 0) {
cs = 0; timeStart = 0;
} }
else { else {
cs = unixtimestamp - rbseconds; timeStart = unixtimestamp - startTime;
}
if (endTime <= 0) {
timeEnd = 0;
}
else {
timeEnd = unixtimestamp - endTime;
} }
} }
final long stime = cs;
final long finalTimeStart = timeStart;
final long finalTimeEnd = timeEnd;
final Integer[] radius = argRadius; final Integer[] radius = argRadius;
try { try {
@ -701,7 +713,7 @@ public class LookupCommand {
List<String> uuidList = new ArrayList<>(); List<String> uuidList = new ArrayList<>();
Location location = finalLocation; Location location = finalLocation;
boolean exists = false; boolean exists = false;
String bc = finalX + "." + finalY + "." + finalZ + "." + finalWid + "." + stime + "." + noisy + "." + excluded + "." + restricted + "." + finalArgWid + "." + displayResults; String bc = finalX + "." + finalY + "." + finalZ + "." + finalWid + "." + finalTimeStart + "." + finalTimeEnd + "." + noisy + "." + excluded + "." + restricted + "." + finalArgWid + "." + displayResults;
ConfigHandler.lookupCommand.put(player2.getName(), bc); ConfigHandler.lookupCommand.put(player2.getName(), bc);
ConfigHandler.lookupPage.put(player2.getName(), page); ConfigHandler.lookupPage.put(player2.getName(), page);
ConfigHandler.lookupTime.put(player2.getName(), rtime); ConfigHandler.lookupTime.put(player2.getName(), rtime);
@ -788,7 +800,7 @@ public class LookupCommand {
} }
if (checkRows) { if (checkRows) {
rows = Lookup.countLookupRows(statement, player2, uuidList, userList, blist, elist, euserlist, finalArgAction, location, radius, rowData, stime, restrict_world, true); rows = Lookup.countLookupRows(statement, player2, uuidList, userList, blist, elist, euserlist, finalArgAction, location, radius, rowData, finalTimeStart, finalTimeEnd, restrict_world, true);
rowData[3] = rows; rowData[3] = rows;
ConfigHandler.lookupRows.put(player2.getName(), rowData); ConfigHandler.lookupRows.put(player2.getName(), rowData);
} }
@ -797,7 +809,7 @@ public class LookupCommand {
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.LOOKUP_ROWS_FOUND, row_format, (rows == 1 ? Selector.FIRST : Selector.SECOND))); Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.LOOKUP_ROWS_FOUND, row_format, (rows == 1 ? Selector.FIRST : Selector.SECOND)));
} }
else if (pageStart < rows) { else if (pageStart < rows) {
List<String[]> lookupList = Lookup.performPartialLookup(statement, player2, uuidList, userList, blist, elist, euserlist, finalArgAction, location, radius, rowData, stime, (int) pageStart, displayResults, restrict_world, true); List<String[]> lookupList = Lookup.performPartialLookup(statement, player2, uuidList, userList, blist, elist, euserlist, finalArgAction, location, radius, rowData, finalTimeStart, finalTimeEnd, (int) pageStart, displayResults, restrict_world, true);
Chat.sendMessage(player2, Color.WHITE + "----- " + Color.DARK_AQUA + Phrase.build(Phrase.LOOKUP_HEADER, "CoreProtect" + Color.WHITE + " | " + Color.DARK_AQUA) + Color.WHITE + " -----"); Chat.sendMessage(player2, Color.WHITE + "----- " + Color.DARK_AQUA + Phrase.build(Phrase.LOOKUP_HEADER, "CoreProtect" + Color.WHITE + " | " + Color.DARK_AQUA) + Color.WHITE + " -----");
if (finalArgAction.contains(6) || finalArgAction.contains(7)) { // Chat/command if (finalArgAction.contains(6) || finalArgAction.contains(7)) { // Chat/command

View file

@ -31,10 +31,12 @@ public class PurgeCommand extends Consumer {
int resultc = args.length; int resultc = args.length;
Location location = CommandHandler.parseLocation(player, args); Location location = CommandHandler.parseLocation(player, args);
final Integer[] argRadius = CommandHandler.parseRadius(args, player, location); final Integer[] argRadius = CommandHandler.parseRadius(args, player, location);
final long seconds = CommandHandler.parseTime(args); final long[] argTime = CommandHandler.parseTime(args);
final int argWid = CommandHandler.parseWorld(args, false, false); final int argWid = CommandHandler.parseWorld(args, false, false);
final List<Integer> argAction = CommandHandler.parseAction(args); final List<Integer> argAction = CommandHandler.parseAction(args);
final List<Integer> supportedActions = Arrays.asList(); final List<Integer> supportedActions = Arrays.asList();
long startTime = argTime[1] > 0 ? argTime[0] : 0;
long endTime = argTime[1] > 0 ? argTime[1] : argTime[0];
if (ConfigHandler.converterRunning) { if (ConfigHandler.converterRunning) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.UPGRADE_IN_PROGRESS)); Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.UPGRADE_IN_PROGRESS));
@ -52,7 +54,7 @@ public class PurgeCommand extends Consumer {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_PARAMETERS, "/co purge t:<time>")); Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_PARAMETERS, "/co purge t:<time>"));
return; return;
} }
if (seconds <= 0) { if (endTime <= 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_PARAMETERS, "/co purge t:<time>")); Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_PARAMETERS, "/co purge t:<time>"));
return; return;
} }
@ -72,11 +74,11 @@ public class PurgeCommand extends Consumer {
return; return;
} }
} }
if (player instanceof Player && seconds < 2592000) { if (player instanceof Player && endTime < 2592000) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_MINIMUM_TIME, "30", Selector.FIRST)); // 30 days Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_MINIMUM_TIME, "30", Selector.FIRST)); // 30 days
return; return;
} }
else if (seconds < 86400) { else if (endTime < 86400) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_MINIMUM_TIME, "24", Selector.SECOND)); // 24 hours Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_MINIMUM_TIME, "24", Selector.SECOND)); // 24 hours
return; return;
} }
@ -96,7 +98,8 @@ public class PurgeCommand extends Consumer {
public void run() { public void run() {
try { try {
long timestamp = (System.currentTimeMillis() / 1000L); long timestamp = (System.currentTimeMillis() / 1000L);
long ptime = timestamp - seconds; long timeStart = startTime > 0 ? (timestamp - startTime) : 0;
long timeEnd = timestamp - endTime;
long removed = 0; long removed = 0;
Connection connection = null; Connection connection = null;
@ -196,10 +199,10 @@ public class PurgeCommand extends Consumer {
String timeLimit = ""; String timeLimit = "";
if (purgeTables.contains(table)) { if (purgeTables.contains(table)) {
if (argWid > 0 && worldTables.contains(table)) { if (argWid > 0 && worldTables.contains(table)) {
timeLimit = " WHERE (wid = '" + argWid + "' AND time >= '" + ptime + "') OR wid != '" + argWid + "'"; timeLimit = " WHERE (wid = '" + argWid + "' AND (time >= '" + timeEnd + "' OR time < '" + timeStart + "')) OR wid != '" + argWid + "'";
} }
else if (argWid == 0) { else if (argWid == 0) {
timeLimit = " WHERE time >= '" + ptime + "'"; timeLimit = " WHERE (time >= '" + timeEnd + "' OR time < '" + timeStart + "')";
} }
} }
query = "INSERT INTO " + purgePrefix + table + " SELECT " + columns + " FROM " + ConfigHandler.prefix + table + timeLimit; query = "INSERT INTO " + purgePrefix + table + " SELECT " + columns + " FROM " + ConfigHandler.prefix + table + timeLimit;
@ -262,7 +265,7 @@ public class PurgeCommand extends Consumer {
} }
if (purge) { if (purge) {
query = "DELETE FROM " + purgePrefix + table + " WHERE time < '" + ptime + "'" + worldRestriction; query = "DELETE FROM " + purgePrefix + table + " WHERE time < '" + timeEnd + "' AND time >= '" + timeStart + "'" + worldRestriction;
preparedStmt = connection.prepareStatement(query); preparedStmt = connection.prepareStatement(query);
preparedStmt.execute(); preparedStmt.execute();
preparedStmt.close(); preparedStmt.close();
@ -321,7 +324,7 @@ public class PurgeCommand extends Consumer {
} }
if (purge) { if (purge) {
query = "DELETE FROM " + ConfigHandler.prefix + table + " WHERE time < '" + ptime + "'" + worldRestriction; query = "DELETE FROM " + ConfigHandler.prefix + table + " WHERE time < '" + timeEnd + "' AND time >= '" + timeStart + "'" + worldRestriction;
preparedStmt = connection.prepareStatement(query); preparedStmt = connection.prepareStatement(query);
preparedStmt.execute(); preparedStmt.execute();
removed = removed + preparedStmt.getUpdateCount(); removed = removed + preparedStmt.getUpdateCount();

View file

@ -31,7 +31,7 @@ import net.coreprotect.utility.Color;
import net.coreprotect.utility.Util; import net.coreprotect.utility.Util;
public class RollbackRestoreCommand { public class RollbackRestoreCommand {
protected static void runCommand(CommandSender player, Command command, boolean permission, String[] args, Location argLocation, long forceSeconds) { protected static void runCommand(CommandSender player, Command command, boolean permission, String[] args, Location argLocation, long forceStart, long forceEnd) {
Location lo = (argLocation != null ? argLocation : CommandHandler.parseLocation(player, args)); Location lo = (argLocation != null ? argLocation : CommandHandler.parseLocation(player, args));
List<String> argUuids = new ArrayList<>(); List<String> argUuids = new ArrayList<>();
List<String> argUsers = CommandHandler.parseUsers(args); List<String> argUsers = CommandHandler.parseUsers(args);
@ -42,7 +42,9 @@ public class RollbackRestoreCommand {
List<Object> argExclude = CommandHandler.parseExcluded(player, args, argAction); List<Object> argExclude = CommandHandler.parseExcluded(player, args, argAction);
List<String> argExcludeUsers = CommandHandler.parseExcludedUsers(player, args); List<String> argExcludeUsers = CommandHandler.parseExcludedUsers(player, args);
String ts = CommandHandler.parseTimeString(args); String ts = CommandHandler.parseTimeString(args);
long rbSeconds = CommandHandler.parseTime(args); long[] argTime = CommandHandler.parseTime(args);
long startTime = argTime[0];
long endTime = argTime[1];
int argWid = CommandHandler.parseWorld(args, true, true); int argWid = CommandHandler.parseWorld(args, true, true);
boolean count = CommandHandler.parseCount(args); boolean count = CommandHandler.parseCount(args);
boolean worldedit = CommandHandler.parseWorldEdit(args); boolean worldedit = CommandHandler.parseWorldEdit(args);
@ -139,7 +141,7 @@ public class RollbackRestoreCommand {
return; return;
} }
} }
if (preview > 1 && forceSeconds <= 0) { if (preview > 1 && forceStart <= 0) {
preview = 1; preview = 1;
} }
@ -310,13 +312,16 @@ public class RollbackRestoreCommand {
} }
final List<String> rollbackusers2 = rollbackusers; final List<String> rollbackusers2 = rollbackusers;
if (rbSeconds > 0) { if (startTime > 0) {
long unixtimestamp = (System.currentTimeMillis() / 1000L); long unixtimestamp = (System.currentTimeMillis() / 1000L);
long seconds = unixtimestamp - rbSeconds; long timeStart = unixtimestamp - startTime;
if (forceSeconds > 0) { long timeEnd = endTime > 0 ? (unixtimestamp - endTime) : 0;
seconds = forceSeconds; if (forceStart > 0) {
timeStart = forceStart;
timeEnd = forceEnd;
} }
final long stime = seconds; final long finalTimeStart = timeStart;
final long finalTimeEnd = timeEnd;
final Integer[] radius = argRadius; final Integer[] radius = argRadius;
try { try {
final CommandSender player2 = player; final CommandSender player2 = player;
@ -416,14 +421,15 @@ public class RollbackRestoreCommand {
} }
if (finalArgAction.contains(5)) { if (finalArgAction.contains(5)) {
ContainerRollback.performContainerRollbackRestore(statement, player2, uuidList, rollbackusers2, rtime, blist, elist, euserlist, finalArgAction, location, radius, stime, restrictWorld, false, verbose, action); ContainerRollback.performContainerRollbackRestore(statement, player2, uuidList, rollbackusers2, rtime, blist, elist, euserlist, finalArgAction, location, radius, finalTimeStart, finalTimeEnd, restrictWorld, false, verbose, action);
} }
else { else {
Rollback.performRollbackRestore(statement, player2, uuidList, rollbackusers2, rtime, blist, elist, euserlist, finalArgAction, location, radius, stime, restrictWorld, false, verbose, action, finalPreview); Rollback.performRollbackRestore(statement, player2, uuidList, rollbackusers2, rtime, blist, elist, euserlist, finalArgAction, location, radius, finalTimeStart, finalTimeEnd, restrictWorld, false, verbose, action, finalPreview);
} }
if (finalPreview < 2) { if (finalPreview < 2) {
List<Object> list = new ArrayList<>(); List<Object> list = new ArrayList<>();
list.add(stime); list.add(finalTimeStart);
list.add(finalTimeEnd);
list.add(finalArgs); list.add(finalArgs);
list.add(locationFinal); list.add(locationFinal);
ConfigHandler.lastRollback.put(player2.getName(), list); ConfigHandler.lastRollback.put(player2.getName(), list);

View file

@ -17,9 +17,10 @@ public class UndoCommand {
try { try {
if (ConfigHandler.lastRollback.get(user.getName()) != null) { if (ConfigHandler.lastRollback.get(user.getName()) != null) {
List<Object> list = ConfigHandler.lastRollback.get(user.getName()); List<Object> list = ConfigHandler.lastRollback.get(user.getName());
long time = (Long) list.get(0); long startTime = (Long) list.get(0);
args = (String[]) list.get(1); long endTime = (Long) list.get(1);
Location location = (Location) list.get(2); args = (String[]) list.get(2);
Location location = (Location) list.get(3);
for (String arg : args) { for (String arg : args) {
if (arg.equals("#preview")) { if (arg.equals("#preview")) {
CancelCommand.runCommand(user, command, permission, args); CancelCommand.runCommand(user, command, permission, args);
@ -38,7 +39,7 @@ public class UndoCommand {
} }
if (valid) { if (valid) {
ConfigHandler.lastRollback.remove(user.getName()); ConfigHandler.lastRollback.remove(user.getName());
RollbackRestoreCommand.runCommand(user, command, permission, args, location, time); RollbackRestoreCommand.runCommand(user, command, permission, args, location, startTime, endTime);
} }
} }
else { else {

View file

@ -28,11 +28,11 @@ import net.coreprotect.utility.Util;
public class ContainerRollback extends Queue { public class ContainerRollback extends Queue {
public static void performContainerRollbackRestore(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, String timeString, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, final Location location, Integer[] radius, long checkTime, boolean restrictWorld, boolean lookup, boolean verbose, final int rollbackType) { public static void performContainerRollbackRestore(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, String timeString, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, final Location location, Integer[] radius, long startTime, long endTime, boolean restrictWorld, boolean lookup, boolean verbose, final int rollbackType) {
try { try {
long startTime = System.currentTimeMillis(); long timeStart = System.currentTimeMillis();
final List<Object[]> lookupList = Lookup.performLookupRaw(statement, user, checkUuids, checkUsers, restrictList, excludeList, excludeUserList, actionList, location, radius, null, checkTime, -1, -1, restrictWorld, lookup); final List<Object[]> lookupList = Lookup.performLookupRaw(statement, user, checkUuids, checkUsers, restrictList, excludeList, excludeUserList, actionList, location, radius, null, startTime, endTime, -1, -1, restrictWorld, lookup);
if (rollbackType == 1) { if (rollbackType == 1) {
Collections.reverse(lookupList); Collections.reverse(lookupList);
} }
@ -164,8 +164,8 @@ public class ContainerRollback extends Queue {
rollbackHashData = ConfigHandler.rollbackHash.get(finalUserString); rollbackHashData = ConfigHandler.rollbackHash.get(finalUserString);
int blockCount = rollbackHashData[1]; int blockCount = rollbackHashData[1];
long endTime = System.currentTimeMillis(); long timeFinish = System.currentTimeMillis();
double totalSeconds = (endTime - startTime) / 1000.0; double totalSeconds = (timeFinish - timeStart) / 1000.0;
if (user != null) { if (user != null) {
int file = -1; int file = -1;

View file

@ -75,7 +75,7 @@ public class Lookup extends Queue {
return newList; return newList;
} }
public static long countLookupRows(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, Long[] rowData, long checkTime, boolean restrictWorld, boolean lookup) { public static long countLookupRows(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, Long[] rowData, long startTime, long endTime, boolean restrictWorld, boolean lookup) {
Long rows = 0L; Long rows = 0L;
try { try {
@ -84,7 +84,7 @@ public class Lookup extends Queue {
} }
Consumer.isPaused = true; Consumer.isPaused = true;
ResultSet results = rawLookupResultSet(statement, user, checkUuids, checkUsers, restrictList, excludeList, excludeUserList, actionList, location, radius, null, checkTime, -1, -1, restrictWorld, lookup, true); ResultSet results = rawLookupResultSet(statement, user, checkUuids, checkUsers, restrictList, excludeList, excludeUserList, actionList, location, radius, null, startTime, endTime, -1, -1, restrictWorld, lookup, true);
while (results.next()) { while (results.next()) {
int resultTable = results.getInt("tbl"); int resultTable = results.getInt("tbl");
long count = results.getLong("count"); long count = results.getLong("count");
@ -102,11 +102,11 @@ public class Lookup extends Queue {
return rows; return rows;
} }
public static List<String[]> performLookup(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, long checkTime, boolean restrictWorld, boolean lookup) { public static List<String[]> performLookup(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, long startTime, long endTime, boolean restrictWorld, boolean lookup) {
List<String[]> newList = new ArrayList<>(); List<String[]> newList = new ArrayList<>();
try { try {
List<Object[]> lookupList = performLookupRaw(statement, user, checkUuids, checkUsers, restrictList, excludeList, excludeUserList, actionList, location, radius, null, checkTime, -1, -1, restrictWorld, lookup); List<Object[]> lookupList = performLookupRaw(statement, user, checkUuids, checkUsers, restrictList, excludeList, excludeUserList, actionList, location, radius, null, startTime, endTime, -1, -1, restrictWorld, lookup);
newList = convertRawLookup(statement, lookupList); newList = convertRawLookup(statement, lookupList);
} }
catch (Exception e) { catch (Exception e) {
@ -116,7 +116,7 @@ public class Lookup extends Queue {
return newList; return newList;
} }
static List<Object[]> performLookupRaw(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, Long[] rowData, long checkTime, int limitOffset, int limitCount, boolean restrictWorld, boolean lookup) { static List<Object[]> performLookupRaw(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, Long[] rowData, long startTime, long endTime, int limitOffset, int limitCount, boolean restrictWorld, boolean lookup) {
List<Object[]> list = new ArrayList<>(); List<Object[]> list = new ArrayList<>();
List<Integer> invalidRollbackActions = new ArrayList<>(); List<Integer> invalidRollbackActions = new ArrayList<>();
invalidRollbackActions.add(2); invalidRollbackActions.add(2);
@ -136,7 +136,7 @@ public class Lookup extends Queue {
Consumer.isPaused = true; Consumer.isPaused = true;
ResultSet results = rawLookupResultSet(statement, user, checkUuids, checkUsers, restrictList, excludeList, excludeUserList, actionList, location, radius, rowData, checkTime, limitOffset, limitCount, restrictWorld, lookup, false); ResultSet results = rawLookupResultSet(statement, user, checkUuids, checkUsers, restrictList, excludeList, excludeUserList, actionList, location, radius, rowData, startTime, endTime, limitOffset, limitCount, restrictWorld, lookup, false);
while (results.next()) { while (results.next()) {
if (actionList.contains(6) || actionList.contains(7)) { if (actionList.contains(6) || actionList.contains(7)) {
@ -272,11 +272,11 @@ public class Lookup extends Queue {
return list; return list;
} }
public static List<String[]> performPartialLookup(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, Long[] rowData, long checkTime, int limitOffset, int limitCount, boolean restrictWorld, boolean lookup) { public static List<String[]> performPartialLookup(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, Long[] rowData, long startTime, long endTime, int limitOffset, int limitCount, boolean restrictWorld, boolean lookup) {
List<String[]> newList = new ArrayList<>(); List<String[]> newList = new ArrayList<>();
try { try {
List<Object[]> lookupList = performLookupRaw(statement, user, checkUuids, checkUsers, restrictList, excludeList, excludeUserList, actionList, location, radius, rowData, checkTime, limitOffset, limitCount, restrictWorld, lookup); List<Object[]> lookupList = performLookupRaw(statement, user, checkUuids, checkUsers, restrictList, excludeList, excludeUserList, actionList, location, radius, rowData, startTime, endTime, limitOffset, limitCount, restrictWorld, lookup);
newList = convertRawLookup(statement, lookupList); newList = convertRawLookup(statement, lookupList);
} }
catch (Exception e) { catch (Exception e) {
@ -286,7 +286,7 @@ public class Lookup extends Queue {
return newList; return newList;
} }
private static ResultSet rawLookupResultSet(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, Long[] rowData, long checkTime, int limitOffset, int limitCount, boolean restrictWorld, boolean lookup, boolean count) { private static ResultSet rawLookupResultSet(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, Long[] rowData, long startTime, long endTime, int limitOffset, int limitCount, boolean restrictWorld, boolean lookup, boolean count) {
ResultSet results = null; ResultSet results = null;
try { try {
@ -570,8 +570,12 @@ public class Lookup extends Queue {
queryBlock = queryBlock + " user NOT IN(" + excludeUsers + ") AND"; queryBlock = queryBlock + " user NOT IN(" + excludeUsers + ") AND";
} }
if (checkTime > 0) { if (startTime > 0) {
queryBlock = queryBlock + " time > '" + checkTime + "' AND"; queryBlock = queryBlock + " time > '" + startTime + "' AND";
}
if (endTime > 0) {
queryBlock = queryBlock + " time <= '" + endTime + "' AND";
} }
if (actionList.contains(10)) { if (actionList.contains(10)) {

View file

@ -95,15 +95,15 @@ import net.coreprotect.utility.entity.HangingUtil;
public class Rollback extends Queue { public class Rollback extends Queue {
public static List<String[]> performRollbackRestore(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, String timeString, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, long checkTime, boolean restrictWorld, boolean lookup, boolean verbose, final int rollbackType, final int preview) { public static List<String[]> performRollbackRestore(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, String timeString, List<Object> restrictList, List<Object> excludeList, List<String> excludeUserList, List<Integer> actionList, Location location, Integer[] radius, long startTime, long endTime, boolean restrictWorld, boolean lookup, boolean verbose, final int rollbackType, final int preview) {
List<String[]> list = new ArrayList<>(); List<String[]> list = new ArrayList<>();
try { try {
long startTime = System.currentTimeMillis(); long timeStart = System.currentTimeMillis();
List<Object[]> lookupList = new ArrayList<>(); List<Object[]> lookupList = new ArrayList<>();
if (!actionList.contains(4) && !actionList.contains(5) && !checkUsers.contains("#container")) { if (!actionList.contains(4) && !actionList.contains(5) && !checkUsers.contains("#container")) {
lookupList = Lookup.performLookupRaw(statement, user, checkUuids, checkUsers, restrictList, excludeList, excludeUserList, actionList, location, radius, null, checkTime, -1, -1, restrictWorld, lookup); lookupList = Lookup.performLookupRaw(statement, user, checkUuids, checkUsers, restrictList, excludeList, excludeUserList, actionList, location, radius, null, startTime, endTime, -1, -1, restrictWorld, lookup);
} }
if (lookupList == null) { if (lookupList == null) {
@ -137,7 +137,7 @@ public class Rollback extends Queue {
itemActionList.add(4); itemActionList.add(4);
} }
itemList = Lookup.performLookupRaw(statement, user, checkUuids, checkUsers, itemRestrictList, itemExcludeList, excludeUserList, itemActionList, location, radius, null, checkTime, -1, -1, restrictWorld, lookup); itemList = Lookup.performLookupRaw(statement, user, checkUuids, checkUsers, itemRestrictList, itemExcludeList, excludeUserList, itemActionList, location, radius, null, startTime, endTime, -1, -1, restrictWorld, lookup);
} }
TreeMap<Long, Integer> chunkList = new TreeMap<>(); TreeMap<Long, Integer> chunkList = new TreeMap<>();
@ -1255,8 +1255,8 @@ public class Rollback extends Queue {
int itemCount = rollbackHashData[0]; int itemCount = rollbackHashData[0];
int blockCount = rollbackHashData[1]; int blockCount = rollbackHashData[1];
int entityCount = rollbackHashData[2]; int entityCount = rollbackHashData[2];
long endTime = System.currentTimeMillis(); long timeFinish = System.currentTimeMillis();
double totalSeconds = (endTime - startTime) / 1000.0; double totalSeconds = (timeFinish - timeStart) / 1000.0;
if (user != null) { if (user != null) {
finishRollbackRestore(user, location, checkUsers, restrictList, excludeList, excludeUserList, actionList, timeString, chunkCount, totalSeconds, itemCount, blockCount, entityCount, rollbackType, radius, verbose, restrictWorld, preview); finishRollbackRestore(user, location, checkUsers, restrictList, excludeList, excludeUserList, actionList, timeString, chunkCount, totalSeconds, itemCount, blockCount, entityCount, rollbackType, radius, verbose, restrictWorld, preview);