Fix mass purge

This commit is contained in:
Jesse Boyd 2017-03-15 01:28:02 +11:00
parent b0df79bb80
commit e208d7f72a
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
3 changed files with 6 additions and 2 deletions

View File

@ -146,6 +146,7 @@ public class Purge extends SubCommand {
Runnable run = new Runnable() {
@Override
public void run() {
PS.debug("Calculating plots to purge, please wait...");
HashSet<Integer> ids = new HashSet<>();
for (Plot plot : toDelete) {
if (plot.temp != Integer.MAX_VALUE) {

View File

@ -209,6 +209,7 @@ public class Trim extends SubCommand {
@Override
public void run() {
Trim.TASK = false;
player.sendMessage("Trim done!");
}
};
}

View File

@ -2040,9 +2040,8 @@ public class SQLManager implements AbstractDB {
try {
ArrayList<Integer> uniqueIdsList = new ArrayList<Integer>(uniqueIds);
String stmt_prefix = "";
StringBuilder idstr2 = new StringBuilder("");
int size = uniqueIdsList.size();
int packet = 5000;
int packet = 990;
int amount = size / packet;
int count = 0;
int last = -1;
@ -2052,6 +2051,8 @@ public class SQLManager implements AbstractDB {
if (subList.isEmpty()) {
break;
}
StringBuilder idstr2 = new StringBuilder("");
stmt_prefix = "";
for (Integer id : subList) {
idstr2.append(stmt_prefix).append(id);
stmt_prefix = " OR `id` = ";
@ -2082,6 +2083,7 @@ public class SQLManager implements AbstractDB {
.prepareStatement("DELETE FROM `" + SQLManager.this.prefix + "plot` WHERE `id` = " + idstr2);
stmt.executeUpdate();
stmt.close();
commit();
}
} catch (SQLException e) {
e.printStackTrace();