Skip to content

Commit

Permalink
Fixed purge include parameter not functioning correctly for SQLite da…
Browse files Browse the repository at this point in the history
…tabases
  • Loading branch information
Intelli committed Aug 14, 2024
1 parent 888df06 commit 3194c35
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/main/java/net/coreprotect/command/PurgeCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -285,18 +285,22 @@ public void run() {
boolean error = false;
if (!excludeTables.contains(table)) {
try {
boolean purge = true;
String timeLimit = "";
if (purgeTables.contains(table)) {
String blockRestriction = "";
String blockRestriction = "(";
if (hasBlockRestriction && restrictTables.contains(table)) {
blockRestriction = "type IN(" + includeBlockFinal + ") AND ";
blockRestriction = "type NOT IN(" + includeBlockFinal + ") OR (type IN(" + includeBlockFinal + ") AND ";
}
else if (hasBlockRestriction) {
purge = false;
}

if (argWid > 0 && worldTables.contains(table)) {
timeLimit = " WHERE (" + blockRestriction + "wid = '" + argWid + "' AND (time >= '" + timeEnd + "' OR time < '" + timeStart + "')) OR (" + blockRestriction + "wid != '" + argWid + "')";
timeLimit = " WHERE (" + blockRestriction + "wid = '" + argWid + "' AND (time >= '" + timeEnd + "' OR time < '" + timeStart + "'))) OR (wid != '" + argWid + "')";
}
else if (argWid == 0) {
timeLimit = " WHERE " + blockRestriction + "(time >= '" + timeEnd + "' OR time < '" + timeStart + "')";
else if (argWid == 0 && purge) {
timeLimit = " WHERE " + blockRestriction + "(time >= '" + timeEnd + "' OR time < '" + timeStart + "'))";
}
}
query = "INSERT INTO " + purgePrefix + table + " SELECT " + columns + " FROM " + ConfigHandler.prefix + table + timeLimit;
Expand Down

0 comments on commit 3194c35

Please sign in to comment.