mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-21 20:56:45 +01:00
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:
parent
89511f07f9
commit
f5f875eb11
@ -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();
|
||||
}
|
||||
|
||||
}
|
@ -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
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user