diff --git a/src/main/java/com/intellectualcrafters/plot/PS.java b/src/main/java/com/intellectualcrafters/plot/PS.java index 58e9c7bc1..9f0006906 100644 --- a/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/src/main/java/com/intellectualcrafters/plot/PS.java @@ -493,6 +493,32 @@ public class PS { } return result; } + + /** + * Get all the base plots in a single set (for merged plots it just returns the bottom plot) + * @return Set of base Plot + */ + public Set getBasePlots() { + int size = 0; + for (Entry> entry : plots.entrySet()) { + if (isPlotWorld(entry.getKey())) { + size += entry.getValue().size(); + } + } + Set result = new HashSet<>(size); + for (Entry> entry : plots.entrySet()) { + if (isPlotWorld(entry.getKey())) { + for (Entry entry2 : entry.getValue().entrySet()) { + Plot plot = entry2.getValue(); + if (plot.getMerged(0) || plot.getMerged(3)) { + continue; + } + result.add(plot); + } + } + } + return result; + } /** diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Rate.java b/src/main/java/com/intellectualcrafters/plot/commands/Rate.java index c73d6cb8c..61710e920 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Rate.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Rate.java @@ -83,7 +83,7 @@ public class Rate extends SubCommand { }); UUID uuid = player.getUUID(); for (Plot p : plots) { - if ((p.getSettings().ratings == null || !p.getSettings().ratings.containsKey(uuid)) && !p.isAdded(uuid)) { + if (p.isBasePlot() && (p.getSettings().ratings == null || !p.getSettings().ratings.containsKey(uuid)) && !p.isAdded(uuid)) { MainUtil.teleportPlayer(player, player.getLocation(), p); MainUtil.sendMessage(player, C.RATE_THIS); return true; @@ -168,10 +168,6 @@ public class Rate extends SubCommand { return true; } final String arg = args[0]; - - if (arg.equalsIgnoreCase("next")) { - - } final int rating; if (MathMan.isInteger(arg) && arg.length() < 3 && arg.length() > 0) { rating = Integer.parseInt(arg); diff --git a/src/main/java/com/intellectualcrafters/plot/object/Plot.java b/src/main/java/com/intellectualcrafters/plot/object/Plot.java index 21a10bd98..d0926bbf2 100644 --- a/src/main/java/com/intellectualcrafters/plot/object/Plot.java +++ b/src/main/java/com/intellectualcrafters/plot/object/Plot.java @@ -285,6 +285,17 @@ public class Plot { return settings; } + /** + * Returns true if the plot is not merged, or it is the base plot of multiple merged plots + * @return + */ + public boolean isBasePlot() { + if (settings == null) { + return true; + } + return !settings.getMerged(0) && !settings.getMerged(3); + } + public boolean isMerged() { if (settings == null) { return false; diff --git a/src/main/java/com/intellectualcrafters/plot/object/PlotAnalysis.java b/src/main/java/com/intellectualcrafters/plot/object/PlotAnalysis.java index 7c74df345..d11d7800e 100644 --- a/src/main/java/com/intellectualcrafters/plot/object/PlotAnalysis.java +++ b/src/main/java/com/intellectualcrafters/plot/object/PlotAnalysis.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.lang.reflect.Array; import java.util.ArrayDeque; import java.util.ArrayList; +import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; @@ -57,6 +58,10 @@ public class PlotAnalysis { return null; } + public List asList() { + return Arrays.asList(changes, faces, data, air, variety, changes_sd, faces_sd, data_sd, air_sd, variety_sd); + } + public int getComplexity() { if (complexity != 0) { return complexity; diff --git a/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java b/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java index f06ee9a37..b1d3133c6 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java +++ b/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java @@ -125,7 +125,7 @@ public class ExpireManager { if (changed.getComplexity() > Settings.CLEAR_THRESHOLD) { PS.debug("$2[&5Expire&dManager$2] &bIgnoring modified plot: " + plot + " : " + changed.getComplexity() + " - " + changed.changes); expiredPlots.get(world).remove(plot); - FlagManager.addPlotFlag(plot, new Flag(FlagManager.getFlag("analysis"), value)); + FlagManager.addPlotFlag(plot, new Flag(FlagManager.getFlag("analysis"), changed.asList())); return; } }