From 613d79fb3906bac74ed2cb58896a6b2ac3bbfee5 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sat, 28 Apr 2018 21:51:26 +1000 Subject: [PATCH] Fixes #1691 --- Core/src/main/java/com/intellectualcrafters/plot/PS.java | 7 +++++++ .../java/com/intellectualcrafters/plot/commands/Visit.java | 3 ++- .../com/intellectualcrafters/plot/object/PlotArea.java | 7 +++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/PS.java b/Core/src/main/java/com/intellectualcrafters/plot/PS.java index c14067b4e..d37fa9476 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/PS.java @@ -1077,6 +1077,13 @@ public class PS{ return new HashSet<>(myPlots); } + public boolean hasPlot(final UUID uuid) { + for (PlotArea area : manager.getAllPlotAreas()) { + if (area.hasPlot(uuid)) return true; + } + return false; + } + public Set getBasePlots(final UUID uuid) { final ArrayList myplots = new ArrayList<>(); foreachBasePlot(new RunnableVal() { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Visit.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Visit.java index 2a1cc3c99..12adc6c38 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Visit.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Visit.java @@ -76,7 +76,8 @@ public class Visit extends Command { } page = Integer.parseInt(args[1]); case 1: - UUID user = (args.length == 2 || (page != Integer.MIN_VALUE || !MathMan.isInteger(args[0]))) ? UUIDHandler.getUUIDFromString(args[0]) : null; + UUID user = UUIDHandler.getUUIDFromString(args[0]); + if (user != null && !PS.get().hasPlot(user)) user = null; if (page == Integer.MIN_VALUE && user == null && MathMan.isInteger(args[0])) { page = Integer.parseInt(args[0]); unsorted = PS.get().getBasePlots(player); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotArea.java b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotArea.java index cf9506a34..33bd9385d 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotArea.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotArea.java @@ -536,6 +536,13 @@ public abstract class PlotArea { return getPlotsAbs(uuid).size(); } + public boolean hasPlot(UUID uuid) { + for (Entry entry : this.plots.entrySet()) { + if (entry.getValue().isOwner(uuid)) return true; + } + return false; + } + public int getPlotCount(PlotPlayer player) { return player != null ? getPlotCount(player.getUUID()) : 0; }