3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-20 01:40:06 +01:00

fix rollback database query (#2591)

Dieser Commit ist enthalten in:
Hannes Greule 2024-03-02 13:43:38 +01:00 committet von GitHub
Ursprung 3a9bbb7293
Commit f5dfe3ae16
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194

Datei anzeigen

@ -159,18 +159,23 @@ public class RollbackDatabase extends AsyncNotifyQueue {
Future<Integer> future = call(() -> { Future<Integer> future = call(() -> {
try { try {
int count = 0; int count = 0;
String stmtStr; String stmtStr = """
if (ascending) { SELECT * FROM `%sedits`
if (uuid == null) { WHERE `time` > ?
stmtStr = "SELECT * FROM`%sedits` WHERE `time`>? AND `x2`>=? AND `x1`<=? AND `z2`>=? AND `z1`<=? AND " + AND `x2` >= ?
"`y2`>=? AND `y1`<=? ORDER BY `time` , `id`"; AND `x1` <= ?
} else { AND `z2` >= ?
stmtStr = "SELECT * FROM`%sedits` WHERE `time`>? AND `x2`>=? AND `x1`<=? AND `z2`>=? AND `z1`<=? AND " + AND `z1` <= ?
"`y2`>=? AND `y1`<=? AND `player`=? ORDER BY `time` ASC, `id` ASC"; AND `y2` >= ?
AND `y1` <= ?
""";
if (uuid != null) {
stmtStr += "\n AND `player`= ?";
} }
if (ascending) {
stmtStr += "\n ORDER BY `time` ASC, `id` ASC";
} else { } else {
stmtStr = "SELECT * FROM`%sedits` WHERE `time`>? AND `x2`>=? AND `x1`<=? AND `z2`>=? AND `z1`<=? AND " + stmtStr += "\n ORDER BY `time` DESC, `id` DESC";
"`y2`>=? AND `y1`<=? AND `player`=? ORDER BY `time` DESC, `id` DESC";
} }
try (PreparedStatement stmt = connection.prepareStatement(stmtStr.formatted(this.prefix))) { try (PreparedStatement stmt = connection.prepareStatement(stmtStr.formatted(this.prefix))) {
stmt.setInt(1, (int) (minTime / 1000)); stmt.setInt(1, (int) (minTime / 1000));