feat: add HasOwner PlotFilter filter (#4259)

* feat: add HasOwner PlotFilter filter
 - closes #3831

* change since to TODO

* Address feedback

---------

Co-authored-by: Alexander Brandes <mc.cache@web.de>
This commit is contained in:
Jordan 2023-12-07 17:29:10 +00:00 committed by GitHub
parent 89511f07f9
commit f5f875eb11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,31 @@
/*
* PlotSquared, a land and world management plugin for Minecraft.
* Copyright (C) IntellectualSites <https://intellectualsites.com>
* 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 <https://www.gnu.org/licenses/>.
*/
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();
}
}

View File

@ -219,6 +219,16 @@ public final class PlotQuery implements Iterable<Plot> {
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
*