Merge remote-tracking branch 'origin/master'

This commit is contained in:
Sauilitired 2014-10-18 10:24:59 +02:00
commit 5d73a2fd6a

View File

@ -650,42 +650,43 @@ public class DBFunc {
Logger.add(LogLevel.WARNING, "FAILED TO PURGE WORLD '"+world+"'!"); Logger.add(LogLevel.WARNING, "FAILED TO PURGE WORLD '"+world+"'!");
return; return;
} }
if (ids.size() > 0) {
try { try {
String prefix = ""; String prefix = "";
StringBuilder idstr = new StringBuilder(""); StringBuilder idstr = new StringBuilder("");
for (Integer id:ids) { for (Integer id:ids) {
idstr.append(prefix + id); idstr.append(prefix + id);
prefix = " OR `plot_plot_id` = "; prefix = " OR `plot_plot_id` = ";
} }
PreparedStatement stmt = connection.prepareStatement("DELETE FROM `plot_helpers` WHERE `plot_plot_id` = "+idstr+""); PreparedStatement stmt = connection.prepareStatement("DELETE FROM `plot_helpers` WHERE `plot_plot_id` = "+idstr+"");
stmt.executeUpdate(); stmt.executeUpdate();
stmt.close(); stmt.close();
stmt = connection.prepareStatement("DELETE FROM `plot_denied` WHERE `plot_plot_id` = "+idstr+""); stmt = connection.prepareStatement("DELETE FROM `plot_denied` WHERE `plot_plot_id` = "+idstr+"");
stmt.executeUpdate(); stmt.executeUpdate();
stmt.close(); stmt.close();
stmt = connection.prepareStatement("DELETE FROM `plot_settings` WHERE `plot_plot_id` = "+idstr+""); stmt = connection.prepareStatement("DELETE FROM `plot_settings` WHERE `plot_plot_id` = "+idstr+"");
stmt.executeUpdate(); stmt.executeUpdate();
stmt.close(); stmt.close();
stmt = connection.prepareStatement("DELETE FROM `plot_trusted` WHERE `plot_plot_id` = "+idstr+""); stmt = connection.prepareStatement("DELETE FROM `plot_trusted` WHERE `plot_plot_id` = "+idstr+"");
stmt.executeUpdate(); stmt.executeUpdate();
stmt.close(); stmt.close();
stmt = connection.prepareStatement("DELETE FROM `plot` WHERE `world` = ?"); stmt = connection.prepareStatement("DELETE FROM `plot` WHERE `world` = ?");
stmt.setString(1, world); stmt.setString(1, world);
stmt.executeUpdate(); stmt.executeUpdate();
stmt.close(); stmt.close();
} }
catch (SQLException e) { catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
Logger.add(LogLevel.DANGER, "FAILED TO PURGE WORLD '"+world+"'!"); Logger.add(LogLevel.DANGER, "FAILED TO PURGE WORLD '"+world+"'!");
return; return;
}
} }
Logger.add(LogLevel.GENERAL, "SUCCESSFULLY PURGED WORLD '"+world+"'!"); Logger.add(LogLevel.GENERAL, "SUCCESSFULLY PURGED WORLD '"+world+"'!");
} }