Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add HasOwner PlotFilter filter #4259

Merged
merged 3 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,16 @@ public static PlotQuery newQuery() {
return this.addFilter(new OwnersIncludeFilter(owner.getUUID()));
}


NotMyFault marked this conversation as resolved.
Show resolved Hide resolved
/**
* Query only for plots that have an owner
*
* @return The query instance
* @since 6.1.0
dordsor21 marked this conversation as resolved.
Show resolved Hide resolved
*/
public @NonNull PlotQuery hasOwner() {
return this.addFilter(new HasOwnerFilter());
}
NotMyFault marked this conversation as resolved.
Show resolved Hide resolved
/**
* Query for plots with a specific alias
*
Expand Down