From 09424c30b4ba52a659a4a89fd01df4a5fcac57d7 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sat, 11 Apr 2015 14:07:19 +1000 Subject: [PATCH] fixes #251 --- PlotSquared/pom.xml | 2 +- .../java/com/intellectualcrafters/plot/PlotSquared.java | 8 ++++++++ .../com/intellectualcrafters/plot/commands/Denied.java | 2 +- .../intellectualcrafters/plot/database/SQLManager.java | 4 ++-- .../com/intellectualcrafters/plot/flag/FlagManager.java | 3 +-- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/PlotSquared/pom.xml b/PlotSquared/pom.xml index f996a821e..ff65a06fc 100644 --- a/PlotSquared/pom.xml +++ b/PlotSquared/pom.xml @@ -8,7 +8,7 @@ UTF-8 PlotSquared - 2.9.9 + 2.9.11 PlotSquared jar diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java index 6279999e2..6eb055a9c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java @@ -146,6 +146,14 @@ public class PlotSquared { return new LinkedHashSet<>(newplots); } + public static Set getPlotsRaw() { + final ArrayList newplots = new ArrayList<>(); + for (final Entry> entry : plots.entrySet()) { + newplots.addAll(entry.getValue().values()); + } + return new LinkedHashSet<>(newplots); + } + public static ArrayList sortPlots(Collection plots) { ArrayList newPlots = new ArrayList<>(); newPlots.addAll(plots); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java index 9fbe31017..5b0bce5d5 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java @@ -90,7 +90,7 @@ public class Denied extends SubCommand { } final PlotPlayer player = UUIDHandler.getPlayer(uuid); if (!uuid.equals(DBFunc.everyone) && (player != null) && player.isOnline()) { - final Plot pl = MainUtil.getPlot(loc); + final Plot pl = MainUtil.getPlot(player.getLocation()); if ((pl != null) && pl.id.equals(plot.id)) { MainUtil.sendMessage(player, C.YOU_BE_DENIED); player.teleport(BlockManager.manager.getSpawn(loc.getWorld())); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java index 6c7b3e9bd..07a2a518c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java @@ -584,9 +584,9 @@ public class SQLManager implements AbstractDB { public void updateTables() { try { final DatabaseMetaData data = this.connection.getMetaData(); - ResultSet rs = data.getColumns(null, null, this.prefix + "plot_comments", "plot"); + ResultSet rs = data.getColumns(null, null, this.prefix + "plot_comments", "plot_plot_id"); if (rs.next()) { - rs = data.getColumns(null, null, this.prefix + "plot_comments", "hashcode"); + rs = data.getColumns(null, null, this.prefix + "plot_comments", "hashcode"); if (!rs.next()) { rs.close(); final Statement statement = this.connection.createStatement(); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java index 2ac43e608..31777b2cf 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java @@ -67,7 +67,7 @@ public class FlagManager { } } if (PlotSquared.getAllPlotsRaw() != null) { - for (final Plot plot : PlotSquared.getPlots()) { + for (final Plot plot : PlotSquared.getPlotsRaw()) { for (final Flag flag : plot.settings.flags) { if (flag.getAbstractFlag().getKey().equals(af.getKey())) { flag.setKey(af); @@ -319,7 +319,6 @@ public class FlagManager { public static AbstractFlag getFlag(final String string, final boolean create) { if ((getFlag(string) == null) && create) { final AbstractFlag flag = new AbstractFlag(string); - addFlag(flag); return flag; } return getFlag(string);