Package com.plotsquared.core.util.query
Class PlotQuery
java.lang.Object
com.plotsquared.core.util.query.PlotQuery
This represents a plot query, and can be used to
search for plots matching certain criteria.
The queries can be reused as no results are stored in the query itself
-
Method Summary
Modifier and TypeMethodDescriptionallPlots()
Query for all plotsboolean
anyMatch()
Get whether any provided plot matches the given filters.Get all plots that match the given criteriaasList()
Get all plots that match the given criteriaasSet()
Get all plots that match the given criteriaasStream()
Get all plots that match the given criteriaint
count()
Get the amount of plots contained in the query resultQuery for expired plotsgetPaginated
(int pageSize) Get all plots that match the given criteria in the form of aPaginatedPlotResult
Query for plots in a single areainAreas
(@NonNull Collection<PlotArea> areas) Query for plots in specific areasQuery for plots in all areas in a worlditerator()
static PlotQuery
newQuery()
Create a new plot query instancenoPlots()
Don't query at allownedBy
(@NonNull PlotPlayer<?> owner) Query for plots owned by a specific playerQuery for plots owned by a specific playerownersInclude
(@NonNull PlotPlayer<?> owner) Query for base plots where one of the merged plots is owned by a specific playerownersInclude
(@NonNull UUID owner) Query for base plots where one of the merged plots is owned by a specific playerplotsBySearch
(@NonNull String searchTerm) Query for plots based on a search termrelativeToArea
(@NonNull PlotArea plotArea) Defines the area around which plots may be sorted, depending on the sorting strategysorted
(@NonNull Comparator<Plot> comparator) Use a custom comparator to sort the resultsthatPasses
(@NonNull Predicate<Plot> predicate) Query for plots that passes a given predicateQuery for base plots onlyQuery for plots with a specific aliaswithMember
(@NonNull UUID member) Query for plots with a specific member (added/trusted/owner)Query with a pre-defined resultwithSortingStrategy
(@NonNull SortingStrategy strategy) Specify the sorting strategy that will decide how to sort the results.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
newQuery
Create a new plot query instance- Returns:
- New query
-
inArea
Query for plots in a single area- Parameters:
area
- Area- Returns:
- The query instance
-
inWorld
Query for plots in all areas in a world- Parameters:
world
- World name- Returns:
- The query instance
-
inAreas
Query for plots in specific areas- Parameters:
areas
- Plot areas- Returns:
- The query instance
-
expiredPlots
Query for expired plots- Returns:
- The query instance
-
allPlots
Query for all plots- Returns:
- The query instance
-
noPlots
Don't query at all- Returns:
- The query instance
-
plotsBySearch
Query for plots based on a search term- Parameters:
searchTerm
- search term to use (uuid, plotID, username)- Returns:
- The query instance
-
withPlot
Query with a pre-defined result- Parameters:
plot
- to return when Query is searched- Returns:
- The query instance
-
whereBasePlot
Query for base plots only- Returns:
- The query instance
-
ownedBy
Query for plots owned by a specific player- Parameters:
owner
- Owner UUID- Returns:
- The query instance
-
ownedBy
Query for plots owned by a specific player- Parameters:
owner
- Owner- Returns:
- The query instance
-
ownersInclude
Query for base plots where one of the merged plots is owned by a specific player- Parameters:
owner
- Owner UUID- Returns:
- The query instance
- Since:
- 6.1.0
-
ownersInclude
Query for base plots where one of the merged plots is owned by a specific player- Parameters:
owner
- Owner- Returns:
- The query instance
- Since:
- 6.1.0
-
withAlias
Query for plots with a specific alias- Parameters:
alias
- Plot alias- Returns:
- The query instance
-
withMember
Query for plots with a specific member (added/trusted/owner)- Parameters:
member
- Member UUID- Returns:
- The query instance
-
thatPasses
Query for plots that passes a given predicate- Parameters:
predicate
- Predicate- Returns:
- The query instance
-
withSortingStrategy
Specify the sorting strategy that will decide how to sort the results. This only matters if you useasList()
- Parameters:
strategy
- Strategy- Returns:
- The query instance
-
sorted
Use a custom comparator to sort the results- Parameters:
comparator
- Comparator- Returns:
- The query instance
-
relativeToArea
Defines the area around which plots may be sorted, depending on the sorting strategy- Parameters:
plotArea
- Plot area- Returns:
- The query instance
-
asStream
Get all plots that match the given criteria- Returns:
- Matching plots
-
asList
Get all plots that match the given criteria- Returns:
- Matching plots as a mutable
-
asSet
Get all plots that match the given criteria- Returns:
- Matching plots as a mutable set
-
getPaginated
Get all plots that match the given criteria in the form of aPaginatedPlotResult
- Parameters:
pageSize
- The size of the pages. Must be positive.- Returns:
- Paginated plot result
-
asCollection
Get all plots that match the given criteria- Returns:
- Matching plots as an immutable collection
-
count
Get the amount of plots contained in the query result- Returns:
- Result count
-
anyMatch
Get whether any provided plot matches the given filters. If no plot was provided, false will be returned.- Returns:
true
if any provided plot matches the filters.
-
iterator
-