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() { Runnable run = new Runnable() {
@Override @Override
public void run() { public void run() {
PS.debug("Calculating plots to purge, please wait...");
HashSet<Integer> ids = new HashSet<>(); HashSet<Integer> ids = new HashSet<>();
for (Plot plot : toDelete) { for (Plot plot : toDelete) {
if (plot.temp != Integer.MAX_VALUE) { if (plot.temp != Integer.MAX_VALUE) {

View File

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

View File

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