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 PlotQueryallPlots()Query for all plotsbooleananyMatch()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 criteriaintcount()Get the amount of plots contained in the query result@NonNull PlotQueryQuery for expired plots@NonNull PaginatedPlotResultgetPaginated(int pageSize)Get all plots that match the given criteria in the form of aPaginatedPlotResult@NonNull PlotQueryQuery for plots in a single area@NonNull PlotQueryinAreas(@NonNull Collection<PlotArea> areas)Query for plots in specific areas@NonNull PlotQueryQuery for plots in all areas in a worlditerator()static PlotQuerynewQuery()Create a new plot query instance@NonNull PlotQuerynoPlots()Don't query at all@NonNull PlotQueryownedBy(@NonNull PlotPlayer<?> owner)Query for plots owned by a specific player@NonNull PlotQueryQuery for plots owned by a specific player@NonNull PlotQueryownersInclude(@NonNull PlotPlayer<?> owner)Query for base plots where one of the merged plots is owned by a specific player@NonNull PlotQueryownersInclude(@NonNull UUID owner)Query for base plots where one of the merged plots is owned by a specific player@NonNull PlotQueryplotsBySearch(@NonNull String searchTerm)Query for plots based on a search term@NonNull PlotQueryrelativeToArea(@NonNull PlotArea plotArea)Defines the area around which plots may be sorted, depending on the sorting strategy@NonNull PlotQuerysorted(@NonNull Comparator<Plot> comparator)Use a custom comparator to sort the results@NonNull PlotQuerythatPasses(@NonNull Predicate<Plot> predicate)Query for plots that passes a given predicate@NonNull PlotQueryQuery for base plots only@NonNull PlotQueryQuery for plots with a specific alias@NonNull PlotQuerywithMember(@NonNull UUID member)Query for plots with a specific member (added/trusted/owner)@NonNull PlotQueryQuery with a pre-defined result@NonNull PlotQuerywithSortingStrategy(@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, waitMethods 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
-