Package com.plotsquared.core.plot
Class PlotArea
java.lang.Object
com.plotsquared.core.plot.PlotArea
- All Implemented Interfaces:
ComponentLike
- Direct Known Subclasses:
GridPlotWorld
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPlotArea(@NonNull String worldName, @Nullable String id, @NonNull IndependentPlotGenerator generator, @Nullable PlotId min, @Nullable PlotId max, @Nullable YamlConfiguration worldConfiguration, @NonNull GlobalBlockQueue blockQueue) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCluster(@Nullable PlotCluster plotCluster) booleanbooleanaddPlotAbs(@NonNull Plot plot) booleanaddPlotIfAbsent(@NonNull Plot plot) booleanGet whether plot signs are allowed or not.@NotNull ComponentbooleanbuildRangeContainsY(int y) Get if thePlotArea's build range (min build height -> max build height) contains the given y valuebooleancontains(int x, int z) booleanbooleanprotected abstract @NonNull PlotManagerGet the default location for players to be teleported to.voiddeleteMeta(@NonNull String key) Delete the metadata for a key.booleanvoidforEachBasePlot(Consumer<Plot> run) intGet the plot border distance for a worldgetCluster(@NonNull Location location) getCluster(String string) getFirstIntersectingCluster(@NonNull PlotId pos1, @NonNull PlotId pos2) <T> TGet the value associated with the specified flag.<T,V extends PlotFlag<T, ?>>
TgetFlag(V flag) Get the value associated with the specified flag.getId()getMax()Returns the max PlotId.intGet the maximum height players may build in.intGet the max height to which PlotSquared will generate blocks.Get the metadata for a key
For persistent metadata use the flag system<T> @NonNull TgetMin()Returns the minimum value of aPlotId.intGet the minimum height players may build in.intGet the min height from which PlotSquared will generate blocks.getNextFreePlot(PlotPlayer<?> player, @Nullable PlotId start) getOwnedPlot(@NonNull Location location) Get the owned base plot at a location.getOwnedPlotAbs(@NonNull Location location) Get the owned plot at a location.Get the owned Plot at a PlotId.Gets the base plot at a location.getPlotAbs(@NonNull Location location) Gets thePlotat a location.getPlotAbs(@NonNull PlotId id) intRetrieves the number of claimed plot in thePlotArea.intgetPlotCount(@NonNull UUID uuid) intgetPlotCount(@Nullable PlotPlayer<?> player) getPlots()A collection of the claimed plots in thisPlotArea.getPlots(@NonNull PlotPlayer<?> player) Deprecated.getPlotsAbs(UUID uuid) getPlotSelectionOwned(@NonNull PlotId pos1, @NonNull PlotId pos2) Get a set of owned plots within a selection (chooses the best algorithm based on selection size.Deprecated.Poorly implemented.getQueue()Returns the region for this PlotArea, or a CuboidRegion encompassing the whole world if none exists.<T> TgetRoadFlag(Class<? extends PlotFlag<T, ?>> flagClass) Get the value associated with the specified road flag.<T,V extends PlotFlag<T, ?>>
TgetRoadFlag(V flag) Get the value associated with the specified road flag.abstract ConfigurationNode[]Used for the /plot setup command Return null if you do not want to support this featuregetType()intinthashCode()booleanbooleanhasSchematic(@NonNull String schematic) Get whether a schematic with that name is available or not.booleanGet whether the plot area is limited by a world border or not.booleanbooleanisCompatible(@NonNull PlotArea plotArea) Check if a PlotArea is compatible (move/copy etc.).booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanabstract voidvoidWhen a world is created, the following method will be called for each.booleanmergePlots(@NonNull List<PlotId> plotIds, boolean removeRoads) Merge a list of plots together.booleanMerge a list of plots together.Get the location for non-members to be teleported to.booleannotifyIfOutsideBuildArea(PlotPlayer<?> player, int y) Utility method to check if the player is attempting to place blocks outside the build area, and notify of this if the player does not have permissions.voidremoveCluster(@Nullable PlotCluster plotCluster) booleanremovePlot(@NonNull PlotId id) voidSaving core PlotArea settings.voidsetAllowSigns(boolean allowSigns) protected voidsetDefaultHome(BlockLoc defaultHome) voidSession only plot metadata (session is until the server stops).voidsetTerrain(PlotAreaTerrainType terrain) Set the terrain generation type of this plot area.voidsetType(PlotAreaType type) Set the type of this plot area.voidSetup the plot border for a world (usually done when the world is created).Get the plot sign material.toString()booleanGet whether economy is enabled and used on this plot area or not.
-
Field Details
-
plots
-
-
Constructor Details
-
PlotArea
public PlotArea(@NonNull String worldName, @Nullable String id, @NonNull IndependentPlotGenerator generator, @Nullable PlotId min, @Nullable PlotId max, @Nullable YamlConfiguration worldConfiguration, @NonNull GlobalBlockQueue blockQueue)
-
-
Method Details
-
createManager
-
getQueue
-
getRegion
Returns the region for this PlotArea, or a CuboidRegion encompassing the whole world if none exists.- Returns:
- CuboidRegion
-
getMin
Returns the minimum value of aPlotId.- Returns:
- the minimum value for a
PlotId
-
getMax
Returns the max PlotId.- Returns:
- the maximum value for a
PlotId
-
equals
-
getClusters
-
isCompatible
Check if a PlotArea is compatible (move/copy etc.).- Parameters:
plotArea- thePlotAreato compare- Returns:
trueif both areas are compatible
-
loadDefaultConfiguration
When a world is created, the following method will be called for each.- Parameters:
config- Configuration Section
-
loadConfiguration
-
saveConfiguration
Saving core PlotArea settings.- Parameters:
config- Configuration Section
-
toString
-
asComponent
- Specified by:
asComponentin interfaceComponentLike
-
hashCode
-
getSettingNodes
Used for the /plot setup command Return null if you do not want to support this feature- Returns:
- ConfigurationNode[]
-
getPlotAbs
Gets thePlotat a location.- Parameters:
location- the location- Returns:
- the
Plotor null if none exists
-
getPlot
Gets the base plot at a location.- Parameters:
location- the location- Returns:
- base Plot
-
getOwnedPlot
Get the owned base plot at a location.- Parameters:
location- the location- Returns:
- the base plot or null
-
getOwnedPlotAbs
Get the owned plot at a location.- Parameters:
location- the location- Returns:
- Plot or null
-
getOwnedPlotAbs
Get the owned Plot at a PlotId.- Parameters:
id- thePlotId- Returns:
- the plot or null
-
getOwnedPlot
-
contains
-
contains
-
contains
-
buildRangeContainsY
Get if thePlotArea's build range (min build height -> max build height) contains the given y value- Parameters:
y- y height- Returns:
- if build height contains y
-
notifyIfOutsideBuildArea
Utility method to check if the player is attempting to place blocks outside the build area, and notify of this if the player does not have permissions.- Parameters:
player- Player to checky- y height to check- Returns:
- true if outside build area with no permissions
- Since:
- 6.9.1
-
getPlotsAbs
-
getPlots
-
getPlots
A collection of the claimed plots in thisPlotArea.- Returns:
- a collection of claimed plots
-
getPlotCount
-
getPlots
Deprecated.UsegetPlots(UUID)Retrieves the plots for the player in this PlotArea.- Parameters:
player- player to get plots of- Returns:
- set of player's plots
-
hasPlot
-
getPlotCount
-
getPlotAbs
-
getPlot
-
getPlotCount
Retrieves the number of claimed plot in thePlotArea.- Returns:
- the number of claimed plots
-
getCluster
-
getFirstIntersectingCluster
public @Nullable PlotCluster getFirstIntersectingCluster(@NonNull PlotId pos1, @NonNull PlotId pos2) -
setMeta
Session only plot metadata (session is until the server stops).
For persistent metadata use the flag system- Parameters:
key- metadata keyvalue- metadata value
-
getMeta
-
getMeta
Get the metadata for a key
For persistent metadata use the flag system- Parameters:
key- metadata key to get value for- Returns:
- metadata value
-
getBasePlots
-
forEachBasePlot
-
getPlotsRaw
Deprecated.Poorly implemented. May be removed in future.Returns an ImmutableMap of PlotId's and Plots in this PlotArea.- Returns:
- map of PlotId against Plot for all plots in this area
-
getPlotEntries
-
addPlot
-
getNextFreePlot
-
addPlotIfAbsent
-
addPlotAbs
-
getBorder
Get the plot border distance for a world- Returns:
- The border distance or Integer.MAX_VALUE if no border is set
-
setupBorder
Setup the plot border for a world (usually done when the world is created). -
deleteMeta
Delete the metadata for a key. - metadata is session only - deleting other plugin's metadata may cause issues- Parameters:
key- Meta data key
-
canClaim
-
removePlot
-
mergePlots
Merge a list of plots together. This is non-blocking for the world-changes that will be made. To run a task when the world changes are complete, usemergePlots(List, boolean, Runnable);- Parameters:
plotIds- List of plot IDs to mergeremoveRoads- If the roads between plots should be removed- Returns:
- if merges were completed successfully.
-
mergePlots
public boolean mergePlots(@NonNull List<PlotId> plotIds, boolean removeRoads, @Nullable Runnable whenDone) Merge a list of plots together. This is non-blocking for the world-changes that will be made.- Parameters:
plotIds- List of plot IDs to mergeremoveRoads- If the roads between plots should be removedwhenDone- Task to run when any merge world changes are complete. Also runs if no changes were made. Does not run if there was an error or if too few plots IDs were supplied.- Returns:
- if merges were completed successfully.
- Since:
- 6.9.0
-
getPlotSelectionOwned
Get a set of owned plots within a selection (chooses the best algorithm based on selection size. i.e. A selection of billions of plots will work fine- Parameters:
pos1- first corner of selectionpos2- second corner of selection- Returns:
- the plots in the selection which are owned
-
removeCluster
-
addCluster
-
getCluster
-
hasSchematic
Get whether a schematic with that name is available or not. If a schematic is available, it can be used for plot claiming.- Parameters:
schematic- the schematic to look for.- Returns:
trueif the schematic exists,falseotherwise.
-
useEconomy
Get whether economy is enabled and used on this plot area or not.- Returns:
trueif this plot area uses economy,falseotherwise.
-
hasWorldBorder
Get whether the plot area is limited by a world border or not.- Returns:
trueif the plot area has a world border,falseotherwise.
-
allowSigns
Get whether plot signs are allowed or not.- Returns:
trueif plot signs are allowed,falseotherwise.
-
signMaterial
Get the plot sign material.- Returns:
- the sign material.
-
legacySignMaterial
-
getFlag
Get the value associated with the specified flag. This will look at the default values stored inGlobalFlagContainer.- Type Parameters:
T- The flag value type- Parameters:
flagClass- The flag type (Class)- Returns:
- The flag value
-
getFlag
Get the value associated with the specified flag. This will look at the default values stored inGlobalFlagContainer.- Type Parameters:
V- The flag type (Any instance of the flag)T- flag value type- Parameters:
flag- The flag type (Any instance of the flag)- Returns:
- The flag value
-
getRoadFlag
Get the value associated with the specified road flag. This will look at the default values stored inGlobalFlagContainer.- Type Parameters:
T- the flag value type- Parameters:
flagClass- The flag type (Class)- Returns:
- The flag value
-
getRoadFlag
Get the value associated with the specified road flag. This will look at the default values stored inGlobalFlagContainer.- Type Parameters:
V- The flag type (Any instance of the flag)T- flag value type- Parameters:
flag- The flag type (Any instance of the flag)- Returns:
- The flag value
-
getWorldName
-
getId
-
getPlotManager
-
getWorldHash
-
getGenerator
-
isAutoMerge
-
isMiscSpawnUnowned
-
isMobSpawning
-
isMobSpawnerSpawning
-
getPlotBiome
-
isPlotChat
-
isForcingPlotChat
-
isSchematicClaimSpecify
-
isSchematicOnClaim
-
getSchematicFile
-
isSpawnEggs
-
getSignMaterial
-
isSpawnCustom
-
isSpawnBreeding
-
getType
-
setType
Set the type of this plot area.- Parameters:
type- the type of the plot area.
-
getTerrain
-
setTerrain
Set the terrain generation type of this plot area.- Parameters:
terrain- the terrain type of the plot area.
-
isHomeAllowNonmember
-
nonmemberHome
Get the location for non-members to be teleported to.- Since:
- 6.1.4
-
defaultHome
Get the default location for players to be teleported to. May be overridden bynonmemberHomeif the player is not a member of the plot.- Since:
- 6.1.4
-
setDefaultHome
-
getMaxBuildHeight
Get the maximum height players may build in. Exclusive. -
getMinBuildHeight
Get the minimum height players may build in. Inclusive. -
getMinGenHeight
Get the min height from which PlotSquared will generate blocks. Inclusive.- Since:
- 6.6.0
-
getMaxGenHeight
Get the max height to which PlotSquared will generate blocks. Inclusive.- Since:
- 6.6.0
-
getGameMode
-
getPrices
-
getSchematics
-
isRoadFlags
-
getFlagContainer
-
getRoadFlagContainer
-
setAllowSigns
-
getPlots(UUID)