From 5507193782468fec21ff6f5a386976fc085ee72d Mon Sep 17 00:00:00 2001 From: boy0001 Date: Wed, 22 Jul 2015 20:08:52 +1000 Subject: [PATCH] Fix duplicate entries for denied --- .../intellectualcrafters/plot/database/SQLManager.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java index 6aa0868fe..ce5001610 100644 --- a/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java +++ b/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java @@ -868,6 +868,14 @@ public class SQLManager implements AbstractDB { } } } + try (Statement statement = connection.createStatement()) { + statement.executeUpdate("DELETE FROM `" + this.prefix + "plot_denied` WHERE `plot_plot_id` NOT IN (SELECT `id` FROM `" + this.prefix + "plot`)"); + statement.close(); + } + catch (Exception e) { + e.printStackTrace(); + } + rs.close(); try (Statement statement = connection.createStatement();) { for (String table : new String[]{"plot_denied", "plot_helpers", "plot_trusted"} ) { @@ -882,6 +890,7 @@ public class SQLManager implements AbstractDB { PS.log("RESTORING: " + table); } } + statement.close(); } catch (Exception e2) { e2.printStackTrace();