From c42d5390a4e3086dc3d78e4b9d5fbd735605bc83 Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Mon, 24 Aug 2020 13:37:12 +0200 Subject: [PATCH] Allow teleporting to merged plots with multiple owners using /p home --- .../main/java/com/plotsquared/core/command/HomeCommand.java | 2 +- Core/src/main/java/com/plotsquared/core/command/Visit.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/command/HomeCommand.java b/Core/src/main/java/com/plotsquared/core/command/HomeCommand.java index 38942ad11..42c4ff1c5 100644 --- a/Core/src/main/java/com/plotsquared/core/command/HomeCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/HomeCommand.java @@ -84,7 +84,7 @@ public class HomeCommand extends Command { @NotNull private PlotQuery query(@NotNull final PlotPlayer player) { // everything plots need to have in common here - return PlotQuery.newQuery().ownedBy(player); + return PlotQuery.newQuery().thatPasses(plot -> plot.isOwner(player.getUUID())); } @Override public CompletableFuture execute(PlotPlayer player, String[] args, diff --git a/Core/src/main/java/com/plotsquared/core/command/Visit.java b/Core/src/main/java/com/plotsquared/core/command/Visit.java index c5f8b4b6d..0108cc02d 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Visit.java +++ b/Core/src/main/java/com/plotsquared/core/command/Visit.java @@ -40,6 +40,7 @@ import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.query.SortingStrategy; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; +import com.plotsquared.core.uuid.UUIDMapping; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -179,9 +180,9 @@ public class Visit extends Command { } else if (throwable != null || uuids.size() != 1) { Captions.COMMAND_SYNTAX.send(player, getUsage()); } else { - final UUID uuid = uuids.toArray(new UUID[0])[0]; + final UUIDMapping mapping = uuids.toArray(new UUIDMapping[0])[0]; this.visit(player, PlotQuery.newQuery() - .thatPasses(plot -> plot.isOwner(uuid)), + .thatPasses(plot -> plot.isOwner(mapping.getUuid())), finalSortByArea, confirm, whenDone, finalPage1); } });