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 TypeMethodDescription@NonNull PlotQuery
allPlots()
Query for all plotsboolean
anyMatch()
Get whether any provided plot matches the given filters.@NonNull Collection<Plot>
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 result@NonNull PlotQuery
Query for expired plots@NonNull PaginatedPlotResult
getPaginated(int pageSize)
Get all plots that match the given criteria in the form of aPaginatedPlotResult
@NonNull PlotQuery
Query for plots in a single area@NonNull PlotQuery
inAreas(@NonNull Collection<PlotArea> areas)
Query for plots in specific areas@NonNull PlotQuery
Query for plots in all areas in a worlditerator()
static PlotQuery
newQuery()
Create a new plot query instance@NonNull PlotQuery
noPlots()
Don't query at all@NonNull PlotQuery
ownedBy(@NonNull PlotPlayer<?> owner)
Query for plots owned by a specific player@NonNull PlotQuery
Query for plots owned by a specific player@NonNull PlotQuery
ownersInclude(@NonNull PlotPlayer<?> owner)
Query for base plots where one of the merged plots is owned by a specific player@NonNull PlotQuery
ownersInclude(@NonNull UUID owner)
Query for base plots where one of the merged plots is owned by a specific player@NonNull PlotQuery
plotsBySearch(@NonNull String searchTerm)
Query for plots based on a search term@NonNull PlotQuery
relativeToArea(@NonNull PlotArea plotArea)
Defines the area around which plots may be sorted, depending on the sorting strategy@NonNull PlotQuery
sorted(@NonNull Comparator<Plot> comparator)
Use a custom comparator to sort the results@NonNull PlotQuery
thatPasses(@NonNull Predicate<Plot> predicate)
Query for plots that passes a given predicate@NonNull PlotQuery
Query for base plots only@NonNull PlotQuery
Query for plots with a specific alias@NonNull PlotQuery
withMember(@NonNull UUID member)
Query for plots with a specific member (added/trusted/owner)@NonNull PlotQuery
Query with a pre-defined result@NonNull PlotQuery
withSortingStrategy(@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
-
ownersInclude
Query for base plots where one of the merged plots is owned by a specific player- Parameters:
owner
- Owner- Returns:
- The query instance
-
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
public int count()Get the amount of plots contained in the query result- Returns:
- Result count
-
anyMatch
public boolean 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
-