diff --git a/Core/src/main/java/com/plotsquared/core/util/query/HasOwnerFilter.java b/Core/src/main/java/com/plotsquared/core/util/query/HasOwnerFilter.java new file mode 100644 index 000000000..a0da8eb3c --- /dev/null +++ b/Core/src/main/java/com/plotsquared/core/util/query/HasOwnerFilter.java @@ -0,0 +1,31 @@ +/* + * PlotSquared, a land and world management plugin for Minecraft. + * Copyright (C) IntellectualSites + * Copyright (C) IntellectualSites team and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.plotsquared.core.util.query; + +import com.plotsquared.core.plot.Plot; +import org.checkerframework.checker.nullness.qual.NonNull; + +class HasOwnerFilter implements PlotFilter { + + @Override + public boolean accepts(final @NonNull Plot plot) { + return plot.hasOwner(); + } + +} diff --git a/Core/src/main/java/com/plotsquared/core/util/query/PlotQuery.java b/Core/src/main/java/com/plotsquared/core/util/query/PlotQuery.java index de3dc94ad..22063d9f6 100644 --- a/Core/src/main/java/com/plotsquared/core/util/query/PlotQuery.java +++ b/Core/src/main/java/com/plotsquared/core/util/query/PlotQuery.java @@ -219,6 +219,16 @@ public final class PlotQuery implements Iterable { return this.addFilter(new OwnersIncludeFilter(owner.getUUID())); } + /** + * Query only for plots that have an owner + * + * @return The query instance + * @since TODO + */ + + public @NonNull PlotQuery hasOwner() { + return this.addFilter(new HasOwnerFilter()); + } /** * Query for plots with a specific alias *