From 172bcc7677b048ab66b74b8dc377b57e5ceaeda5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Fri, 10 Apr 2020 19:22:12 +0200 Subject: [PATCH] Revert "Replace `getOwnerAbs() == null` with `hasOwner()`" This reverts commit 79620042 --- .../plotsquared/plot/object/Plot.java | 22 +++++++++---------- .../plotsquared/plot/object/PlotHandler.java | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java index 8bfb493f5..cf610f896 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java @@ -487,7 +487,7 @@ public class Plot { * @return true if the player is added/trusted or is the owner */ public boolean isAdded(UUID uuid) { - if (this.hasOwner() || getDenied().contains(uuid)) { + if (this.getOwnerAbs() == null || getDenied().contains(uuid)) { return false; } if (isOwner(uuid)) { @@ -911,7 +911,7 @@ public class Plot { TaskManager.runTask(whenDone); }; for (Plot current : plots) { - if (isDelete || current.hasOwner()) { + if (isDelete || current.getOwnerAbs() == null) { manager.unClaimPlot(current, null); } else { manager.claimPlot(current); @@ -1313,7 +1313,7 @@ public class Plot { * @return false if the Plot has no owner, otherwise true. */ public boolean unclaim() { - if (this.hasOwner()) { + if (this.getOwnerAbs() == null) { return false; } for (Plot current : getConnectedPlots()) { @@ -1698,7 +1698,7 @@ public class Plot { * Sets the plot sign if plot signs are enabled. */ public void setSign() { - if (this.hasOwner()) { + if (this.getOwnerAbs() == null) { this.setSign("unknown"); return; } @@ -1892,7 +1892,7 @@ public class Plot { * @return Future containing the result */ public CompletableFuture swapData(Plot plot) { - if (this.hasOwner()) { + if (this.getOwnerAbs() == null) { if (plot != null && plot.hasOwner()) { plot.moveData(this, null); return CompletableFuture.completedFuture(true); @@ -1927,7 +1927,7 @@ public class Plot { * @return */ public boolean moveData(Plot plot, Runnable whenDone) { - if (this.hasOwner()) { + if (this.getOwnerAbs() == null) { PlotSquared.debug(plot + " is unowned (single)"); TaskManager.runTask(whenDone); return false; @@ -2480,7 +2480,7 @@ public class Plot { */ public boolean autoMerge(Direction dir, int max, UUID uuid, boolean removeRoads) { //Ignore merging if there is no owner for the plot - if (this.hasOwner()) { + if (this.getOwnerAbs() == null) { return false; } Set connected = this.getConnectedPlots(); @@ -2780,7 +2780,7 @@ public class Plot { } Plot current; while ((current = frontier.poll()) != null) { - if (current.hasOwner() || current.settings == null) { + if (current.getOwnerAbs() == null || current.settings == null) { // Invalid plot // merged onto unclaimed plot PlotSquared.debug( @@ -3088,7 +3088,7 @@ public class Plot { * @return true if the owner of the Plot is online */ public boolean isOnline() { - if (this.hasOwner()) { + if (this.getOwnerAbs() == null) { return false; } if (!isMerged()) { @@ -3219,7 +3219,7 @@ public class Plot { Location ob = this.getBottomAbs(); final int offsetX = db.getX() - ob.getX(); final int offsetZ = db.getZ() - ob.getZ(); - if (this.hasOwner()) { + if (this.getOwnerAbs() == null) { TaskManager.runTaskLater(whenDone, 1); return CompletableFuture.completedFuture(false); } @@ -3338,7 +3338,7 @@ public class Plot { Location ob = this.getBottomAbs(); final int offsetX = db.getX() - ob.getX(); final int offsetZ = db.getZ() - ob.getZ(); - if (this.hasOwner()) { + if (this.getOwnerAbs() == null) { TaskManager.runTaskLater(whenDone, 1); return false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotHandler.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotHandler.java index fbaaabbf6..6f7b6413c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotHandler.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotHandler.java @@ -8,7 +8,7 @@ import java.util.UUID; public class PlotHandler { public static boolean sameOwners(@NotNull final Plot plot1, @NotNull final Plot plot2) { - if (plot1.hasOwner() || plot2.hasOwner()) { + if (plot1.getOwnerAbs() == null || plot2.getOwnerAbs() == null) { return false; } final Set owners = plot1.getOwners();