Class PlotArea

java.lang.Object
com.plotsquared.core.plot.PlotArea
Direct Known Subclasses:
GridPlotWorld

public abstract class PlotArea extends Object
  • Field Details

  • Constructor Details

  • Method Details

    • createManager

      protected abstract @NonNull PlotManager createManager()
    • getQueue

      public QueueCoordinator getQueue()
    • getRegion

      public com.sk89q.worldedit.regions.CuboidRegion getRegion()
      Returns the region for this PlotArea, or a CuboidRegion encompassing the whole world if none exists.
      Returns:
      CuboidRegion
    • getMin

      public @NonNull PlotId getMin()
      Returns the minimum value of a PlotId.
      Returns:
      the minimum value for a PlotId
    • getMax

      public @NonNull PlotId getMax()
      Returns the max PlotId.
      Returns:
      the maximum value for a PlotId
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getClusters

      public Set<PlotCluster> getClusters()
    • isCompatible

      public boolean isCompatible(@NonNull PlotArea plotArea)
      Check if a PlotArea is compatible (move/copy etc.).
      Parameters:
      plotArea - the PlotArea to compare
      Returns:
      true if both areas are compatible
    • loadDefaultConfiguration

      public void loadDefaultConfiguration(ConfigurationSection config)
      When a world is created, the following method will be called for each.
      Parameters:
      config - Configuration Section
    • loadConfiguration

      public abstract void loadConfiguration(ConfigurationSection config)
    • saveConfiguration

      public void saveConfiguration(ConfigurationSection config)
      Saving core PlotArea settings.
      Parameters:
      config - Configuration Section
    • toString

      public @NonNull String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getSettingNodes

      public abstract ConfigurationNode[] getSettingNodes()
      Used for the /plot setup command Return null if you do not want to support this feature
      Returns:
      ConfigurationNode[]
    • getPlotAbs

      public @Nullable Plot getPlotAbs(@NonNull Location location)
      Gets the Plot at a location.
      Parameters:
      location - the location
      Returns:
      the Plot or null if none exists
    • getPlot

      public @Nullable Plot getPlot(@NonNull Location location)
      Gets the base plot at a location.
      Parameters:
      location - the location
      Returns:
      base Plot
    • getOwnedPlot

      public @Nullable Plot getOwnedPlot(@NonNull Location location)
      Get the owned base plot at a location.
      Parameters:
      location - the location
      Returns:
      the base plot or null
    • getOwnedPlotAbs

      public @Nullable Plot getOwnedPlotAbs(@NonNull Location location)
      Get the owned plot at a location.
      Parameters:
      location - the location
      Returns:
      Plot or null
    • getOwnedPlotAbs

      public @Nullable Plot getOwnedPlotAbs(@NonNull PlotId id)
      Get the owned Plot at a PlotId.
      Parameters:
      id - the PlotId
      Returns:
      the plot or null
    • getOwnedPlot

      public @Nullable Plot getOwnedPlot(@NonNull PlotId id)
    • contains

      public boolean contains(int x, int z)
    • contains

      public boolean contains(@NonNull PlotId id)
    • contains

      public boolean contains(@NonNull Location location)
    • getPlotsAbs

      public @NonNull Set<Plot> getPlotsAbs(UUID uuid)
    • getPlots

      public @NonNull Set<Plot> getPlots(@NonNull UUID uuid)
    • getPlots

      public Collection<Plot> getPlots()
      A collection of the claimed plots in this PlotArea.
      Returns:
      a collection of claimed plots
    • getPlotCount

      public int getPlotCount(@NonNull UUID uuid)
    • getPlots

      @Deprecated public Set<Plot> getPlots(@NonNull PlotPlayer<?> player)
      Deprecated.
      Retrieves the plots for the player in this PlotArea.
      Parameters:
      player - player to get plots of
      Returns:
      set of player's plots
    • hasPlot

      public boolean hasPlot(@NonNull UUID uuid)
    • getPlotCount

      public int getPlotCount(@Nullable PlotPlayer<?> player)
    • getPlotAbs

      public @Nullable Plot getPlotAbs(@NonNull PlotId id)
    • getPlot

      public @Nullable Plot getPlot(@NonNull PlotId id)
    • getPlotCount

      public int getPlotCount()
      Retrieves the number of claimed plot in the PlotArea.
      Returns:
      the number of claimed plots
    • getCluster

      public @Nullable PlotCluster getCluster(@NonNull Location location)
    • getFirstIntersectingCluster

      public @Nullable PlotCluster getFirstIntersectingCluster(@NonNull PlotId pos1, @NonNull PlotId pos2)
    • setMeta

      public void setMeta(@NonNull String key, @Nullable Object value)
      Session only plot metadata (session is until the server stops).
      For persistent metadata use the flag system
      Parameters:
      key - metadata key
      value - metadata value
    • getMeta

      public <T> @NonNull T getMeta(@NonNull String key, @NonNull T def)
    • getMeta

      public @Nullable Object getMeta(@NonNull String key)
      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

      public @NonNull Set<Plot> getBasePlots()
    • forEachBasePlot

      public void forEachBasePlot(Consumer<Plot> run)
    • getPlotsRaw

      @Deprecated public @NonNull Map<PlotId,​Plot> 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

      public @NonNull Set<Map.Entry<PlotId,​Plot>> getPlotEntries()
    • addPlot

      public boolean addPlot(@NonNull Plot plot)
    • getNextFreePlot

      public Plot getNextFreePlot(PlotPlayer<?> player, @Nullable PlotId start)
    • addPlotIfAbsent

      public boolean addPlotIfAbsent(@NonNull Plot plot)
    • addPlotAbs

      public boolean addPlotAbs(@NonNull Plot plot)
    • getBorder

      public int getBorder()
      Get the plot border distance for a world
      Returns:
      The border distance or Integer.MAX_VALUE if no border is set
    • setupBorder

      public void setupBorder()
      Setup the plot border for a world (usually done when the world is created).
    • deleteMeta

      public void deleteMeta(@NonNull String key)
      Delete the metadata for a key. - metadata is session only - deleting other plugin's metadata may cause issues
      Parameters:
      key - Meta data key
    • canClaim

      public @Nullable List<Plot> canClaim(@Nullable PlotPlayer<?> player, @NonNull PlotId pos1, @NonNull PlotId pos2)
    • removePlot

      public boolean removePlot(@NonNull PlotId id)
    • mergePlots

      public boolean mergePlots(@NonNull List<PlotId> plotIds, boolean removeRoads)
    • getPlotSelectionOwned

      public Set<Plot> getPlotSelectionOwned(@NonNull PlotId pos1, @NonNull PlotId pos2)
      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 selection
      pos2 - second corner of selection
      Returns:
      the plots in the selection which are owned
    • removeCluster

      public void removeCluster(@Nullable PlotCluster plotCluster)
    • addCluster

      public void addCluster(@Nullable PlotCluster plotCluster)
    • getCluster

      public @Nullable PlotCluster getCluster(String string)
    • hasSchematic

      public boolean hasSchematic(@NonNull String schematic)
      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:
      true if the schematic exists, false otherwise.
    • useEconomy

      public boolean useEconomy()
      Get whether economy is enabled and used on this plot area or not.
      Returns:
      true if this plot area uses economy, false otherwise.
    • hasWorldBorder

      public boolean hasWorldBorder()
      Get whether the plot area is limited by a world border or not.
      Returns:
      true if the plot area has a world border, false otherwise.
    • allowSigns

      public boolean allowSigns()
      Get whether plot signs are allowed or not.
      Returns:
      true if plot signs are allow, false otherwise.
    • signMaterial

      public String signMaterial()
      Get the plot sign material.
      Returns:
      the sign material.
    • legacySignMaterial

      public String legacySignMaterial()
    • getFlag

      public <T> T getFlag(Class<? extends PlotFlag<T,​?>> flagClass)
      Get the value associated with the specified flag. This will look at the default values stored in GlobalFlagContainer.
      Type Parameters:
      T - The flag value type
      Parameters:
      flagClass - The flag type (Class)
      Returns:
      The flag value
    • getFlag

      public <T,​ V extends PlotFlag<T,​ ?>> T getFlag(V flag)
      Get the value associated with the specified flag. This will look at the default values stored in GlobalFlagContainer.
      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

      public <T> T getRoadFlag(Class<? extends PlotFlag<T,​?>> flagClass)
      Get the value associated with the specified road flag. This will look at the default values stored in GlobalFlagContainer.
      Type Parameters:
      T - the flag value type
      Parameters:
      flagClass - The flag type (Class)
      Returns:
      The flag value
    • getRoadFlag

      public <T,​ V extends PlotFlag<T,​ ?>> T getRoadFlag(V flag)
      Get the value associated with the specified road flag. This will look at the default values stored in GlobalFlagContainer.
      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

      public @NonNull String getWorldName()
    • getId

      public String getId()
    • getPlotManager

      public @NonNull PlotManager getPlotManager()
    • getWorldHash

      public int getWorldHash()
    • getGenerator

      public @NonNull IndependentPlotGenerator getGenerator()
    • isAutoMerge

      public boolean isAutoMerge()
    • isMiscSpawnUnowned

      public boolean isMiscSpawnUnowned()
    • isMobSpawning

      public boolean isMobSpawning()
    • isMobSpawnerSpawning

      public boolean isMobSpawnerSpawning()
    • getPlotBiome

      public com.sk89q.worldedit.world.biome.BiomeType getPlotBiome()
    • isPlotChat

      public boolean isPlotChat()
    • isForcingPlotChat

      public boolean isForcingPlotChat()
    • isSchematicClaimSpecify

      public boolean isSchematicClaimSpecify()
    • isSchematicOnClaim

      public boolean isSchematicOnClaim()
    • getSchematicFile

      public String getSchematicFile()
    • isSpawnEggs

      public boolean isSpawnEggs()
    • getSignMaterial

      public String getSignMaterial()
    • getLegacySignMaterial

      @Deprecated(forRemoval=true) public String getLegacySignMaterial()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use signMaterial(). This method is used for 1.13 only and will be removed without replacement in favor of signMaterial() once we remove the support for 1.13.
      Get the legacy plot sign material before wall signs used a "wall" stance.
      Returns:
      the legacy sign material.
    • isSpawnCustom

      public boolean isSpawnCustom()
    • isSpawnBreeding

      public boolean isSpawnBreeding()
    • getType

      public PlotAreaType getType()
    • setType

      public void setType(PlotAreaType type)
      Set the type of this plot area.
      Parameters:
      type - the type of the plot area.
    • getTerrain

      public PlotAreaTerrainType getTerrain()
    • setTerrain

      public void setTerrain(PlotAreaTerrainType terrain)
      Set the terrain generation type of this plot area.
      Parameters:
      terrain - the terrain type of the plot area.
    • isHomeAllowNonmember

      public boolean isHomeAllowNonmember()
    • nonmemberHome

      public BlockLoc nonmemberHome()
      Get the location for non-members to be teleported to.
    • defaultHome

      public BlockLoc defaultHome()
      Get the default location for players to be teleported to. May be overriden by nonmemberHome if the player is not a member of the plot.
    • getNonmemberHome

      @Deprecated(forRemoval=true) public PlotLoc getNonmemberHome()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use nonmemberHome
    • getDefaultHome

      @Deprecated(forRemoval=true) public PlotLoc getDefaultHome()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use defaultHome
    • setDefaultHome

      protected void setDefaultHome(BlockLoc defaultHome)
    • getMaxBuildHeight

      public int getMaxBuildHeight()
    • getMinBuildHeight

      public int getMinBuildHeight()
    • getGameMode

      public com.sk89q.worldedit.world.gamemode.GameMode getGameMode()
    • getPrices

      public Map<String,​PlotExpression> getPrices()
    • getSchematics

      protected List<String> getSchematics()
    • isRoadFlags

      public boolean isRoadFlags()
    • getFlagContainer

      public FlagContainer getFlagContainer()
    • getRoadFlagContainer

      public FlagContainer getRoadFlagContainer()
    • setAllowSigns

      public void setAllowSigns(boolean allowSigns)