Allow teleporting to merged plots with multiple owners using /p home

This commit is contained in:
Hannes Greule 2020-08-24 13:37:12 +02:00
parent c53cffb745
commit c42d5390a4
2 changed files with 4 additions and 3 deletions

View File

@ -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<Boolean> execute(PlotPlayer<?> player, String[] args,

View File

@ -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);
}
});