Interface Region

All Superinterfaces:
org.spongepowered.api.data.persistence.DataSerializable
All Known Implementing Classes:
RegionImpl

@ConfigSerializable public interface Region extends org.spongepowered.api.data.persistence.DataSerializable
  • Method Details

    • builder

      static Region.Builder builder()
    • createGlobal

      static Region createGlobal(org.spongepowered.api.ResourceKey world, Map<String,Set<FlagValue>> flags)
    • createGlobal

      static Region createGlobal(org.spongepowered.api.ResourceKey world)
    • createGlobal

      static Region createGlobal(org.spongepowered.api.world.server.ServerWorld world, Map<String,Set<FlagValue>> flags)
    • createGlobal

      static Region createGlobal(org.spongepowered.api.world.server.ServerWorld world)
    • getPlainName

      Optional<String> getPlainName(Locale locale)
      Getting the region name.
      Parameters:
      locale - - language to be checked
    • getName

      net.kyori.adventure.text.Component getName(Locale locale)
      Getting the region name as kyori component.
      Parameters:
      locale - - language to be checked
    • setName

      Region setName(net.kyori.adventure.text.Component name, Locale locale)
      Set region name.
    • getNames

      Map<String,net.kyori.adventure.text.Component> getNames()
    • getOwner

      Optional<org.spongepowered.api.entity.living.player.server.ServerPlayer> getOwner()
      Getting the player-owner of the region, if the owner of the region is a player and he is online.
    • getOwnerUUID

      UUID getOwnerUUID()
      Getting the UUID of the region owner.
    • getOwnerName

      String getOwnerName()
      Getting the name of the region owner.
    • setOwner

      Region setOwner(org.spongepowered.api.entity.living.player.server.ServerPlayer owner)
      Make the player the new owner of the region.
      Parameters:
      owner - - new owner
    • setOwner

      Region setOwner(org.spongepowered.api.profile.GameProfile owner)
      Make the player the new owner of the region.
      Parameters:
      owner - - new owner
    • setTrustType

      Region setTrustType(org.spongepowered.api.entity.living.player.server.ServerPlayer player, TrustTypes type)
      Adding a player to a region.
      Parameters:
      player - - addable player
      type - - assignable trust type
    • setTrustType

      Region setTrustType(org.spongepowered.api.profile.GameProfile player, TrustTypes type)
      Adding a player to a region.
      Parameters:
      player - - addable player
      type - - assignable trust type
    • setTrustType

      Region setTrustType(UUID uuid, TrustTypes type)
      Adding a entity to a region.
      Parameters:
      uuid - - addable entity
      type - - assignable trust type
    • getOwnerData

      MemberData getOwnerData()
      Getting the data of the region owner
    • getMembers

      List<MemberData> getMembers()
      Getting a collection of the region's members.
    • getMemberData

      Optional<MemberData> getMemberData(org.spongepowered.api.entity.living.player.server.ServerPlayer player)
      Getting the data of the region member.
      Parameters:
      player - - checked player.
    • getMemberData

      Optional<MemberData> getMemberData(UUID uuid)
      Getting the data of the region member.
      Parameters:
      uuid - - checked player or entity.
    • getTotalMembers

      int getTotalMembers()
      Total number of members of the region.
    • isCurrentTrustType

      boolean isCurrentTrustType(org.spongepowered.api.entity.living.player.server.ServerPlayer player, TrustTypes level)
      Checking the type of trust in the region.
      Parameters:
      player - - checked player
      level - - checked trust type
      Returns:
      true - if the player has the trust type specified in the check
      false - if the player or entity does not have the type of trust specified in the check, or region is global, or region is admin
    • isCurrentTrustType

      boolean isCurrentTrustType(UUID uuid, TrustTypes level)
      Checking the type of trust in the region.
      Parameters:
      uuid - - player uuid
      level - - checked trust type
      Returns:
      true - if the player or entity has the trust type specified in the check
      false - if the player or entity does not have the type of trust specified in the check, or region is global, or region is admin
    • getTrustType

      TrustTypes getTrustType(org.spongepowered.api.entity.living.player.server.ServerPlayer player)
      Getting a player's type of trust.
      Parameters:
      player - - checked player
      Returns:
      the type without trust(TrustTypes.WITHOUT_TRUST) if the player is not a member of the region
    • getTrustType

      TrustTypes getTrustType(UUID uuid)
      Gaining the trust of a player or entity
      Parameters:
      uuid - - checked entity
      Returns:
      the type without trust(TrustTypes.WITHOUT_TRUST) if the entity is not a member of the region
    • untrust

      void untrust(org.spongepowered.api.entity.living.player.server.ServerPlayer player)
      Removing a player from a region.
    • untrust

      void untrust(UUID uuid)
      Removing a player or entity from a region.
    • isTrusted

      boolean isTrusted(org.spongepowered.api.entity.living.player.server.ServerPlayer player)
      Checking whether a player is a member of a region.
      Parameters:
      player - - checked player
    • isTrusted

      boolean isTrusted(UUID uuid)
      Checking whether a entity is a member of a region.
      Parameters:
      uuid - - checked entity
    • getUniqueId

      UUID getUniqueId()
      Getting the UUID of a region.
    • getWorld

      Optional<org.spongepowered.api.world.server.ServerWorld> getWorld()
      Getting the region world if it is loaded.
    • getWorldKey

      org.spongepowered.api.ResourceKey getWorldKey()
      Getting the world key.
    • getCuboid

      Cuboid getCuboid()
      Getting the region cuboid.
    • getType

      RegionTypes getType()
      Getting the region type.
    • setRegionType

      boolean setRegionType(RegionTypes type)
      Changing the type of region.
      Depending on the specified type, some parameters may change.
      Parameters:
      type - - assignable type
    • isGlobal

      boolean isGlobal()
      Check if the region is global.
    • isAdmin

      boolean isAdmin()
      Check whether the region is an admin region.
    • isArena

      boolean isArena()
      Check if the region is an arena.
    • isBasicClaim

      boolean isBasicClaim()
      Check if the region is basic.
    • isSubdivision

      boolean isSubdivision()
      Check if the region is subdivision.
    • setCuboid

      Region setCuboid(org.spongepowered.math.vector.Vector3i first, org.spongepowered.math.vector.Vector3i second, SelectorTypes selectorType)
      Setting new boundaries for the region.
      Parameters:
      first - - first position
      second - - second position
      selectorType - - type of area selection
    • setCuboid

      Region setCuboid(Cuboid cuboid)
      Setting new boundaries for the region.
    • getParrent

      Optional<Region> getParrent()
      Getting a parent region if it is available.
    • getPrimaryParent

      Region getPrimaryParent()
      Getting the primary parent region.
      Returns:
      the primary parent region if it exists, or the current region if the region has no parent
    • setParrent

      Region setParrent(Region region)
      Specifying the parent region.
    • containsChilds

      boolean containsChilds()
      Checking if there are child regions in the region.
    • getChild

      Region getChild(org.spongepowered.math.vector.Vector3i position)
      Searching for a child region.
      If no region is found, it will return the current region.
    • addChild

      Region addChild(Region region)
      Adding a child region.
    • removeChild

      Region removeChild(Region region)
      Removing a child region.
    • getAllChilds

      List<Region> getAllChilds()
      Recursive search and making a list of all child regions.
    • getChilds

      List<Region> getChilds()
      Getting a list of child regions.
    • getFlags

      Map<String,Set<FlagValue>> getFlags()
      Recursively search and list flagValues from the current region to the oldest parent.
    • getCustomFlags

      Map<String,Set<FlagValue>> getCustomFlags()
      Recursive search and enumeration of flagValues with parameters from the current region to the oldest parent.
    • getFlagValues

      Set<FlagValue> getFlagValues(Flags flagName)
      Getting the values of the flag in the region.
      If there is no flag, an attempt will be made to check it in the parent region.
    • getFlagValues

      Set<FlagValue> getFlagValues(String flagName)
      Getting the values of the flag in the region.
      If there is no flag, an attempt will be made to check it in the parent region.
    • containsFlag

      boolean containsFlag(Flags flagName)
      Checking if a flag is set in the region.
    • containsFlag

      boolean containsFlag(String flagName)
      Checking if a flag is set in the region.
    • getFlagResult

      org.spongepowered.api.util.Tristate getFlagResult(Flags flag, String source, String target)
      Getting the value of the flag in the region.
      If there is no flag, an attempt will be made to check it in the parent region.
    • getFlagResult

      org.spongepowered.api.util.Tristate getFlagResult(String flag, String source, String target)
      Getting the value of the flag in the region.
      If there is no flag, an attempt will be made to check it in the parent region.
    • getFlagResultWhithoutParrents

      org.spongepowered.api.util.Tristate getFlagResultWhithoutParrents(Flags flag, String source, String target)
      Getting the value of the flag if there is one.
    • getFlagResultWhithoutParrents

      org.spongepowered.api.util.Tristate getFlagResultWhithoutParrents(String flag, String source, String target)
      Getting the value of the flag if there is one.
    • setFlag

      Region setFlag(Flags flagName, boolean value)
      Setting the value of the flag.
    • setFlag

      Region setFlag(String flagName, boolean value)
      Setting the value of the flag.
    • setFlag

      Region setFlag(Flags flagName, boolean value, String source, String target)
      Setting the value of the flag.
    • setFlag

      Region setFlag(String flagName, boolean value, String source, String target)
      Setting the value of the flag.
    • setTempFlag

      Region setTempFlag(Flags flagName, boolean value, String source, String target)
      Setting the value of the flag.
      The flag set via this method will not be saved to disk.
    • setTempFlag

      Region setTempFlag(String flagName, boolean value, String source, String target)
      Setting the value of the flag.
      The flag set via this method will not be saved to disk.
    • setFlags

      Region setFlags(Map<String,Set<FlagValue>> flags)
      Set the values of a set of flags.
      Parameters:
      flags - - Map with flags and their values.
    • removeFlag

      Region removeFlag(Flags flagName)
      Removing the flag from the region.
    • removeFlag

      Region removeFlag(String flagName)
      Removing the flag from the region.
    • removeFlag

      Region removeFlag(Flags flagName, String source, String target)
      Removing the flag from the region.
    • removeFlag

      Region removeFlag(String flagName, String source, String target)
      Removing the flag from the region.
    • removeTempFlag

      Region removeTempFlag(Flags flagName, String source, String target)
      Removing a temporary flag from a region.
    • removeTempFlag

      Region removeTempFlag(String flagName, String source, String target)
      Removing a temporary flag from a region.
    • removeFlag

      Region removeFlag(Flags flagName, FlagValue flagValue)
      Removing the flag from the region.
    • removeFlag

      Region removeFlag(String flagName, FlagValue flagValue)
      Removing the flag from the region.
    • getCreationTime

      long getCreationTime()
      Get the region creation time in unix format.
    • getJoinMessage

      Optional<net.kyori.adventure.text.Component> getJoinMessage(Locale locale)
      Getting region join message.
      If the specified localization is not found, the default localization will be checked.
      If no default localization is found, the first value found will be returned or an empty optional value if the list is empty.
      Parameters:
      locale - - checking locale
    • setJoinMessage

      Region setJoinMessage(net.kyori.adventure.text.Component message, Locale locale)
      Setting region join message.
      Parameters:
      message - - setting message
      locale - - setting locale
    • getJoinMessages

      Map<String,net.kyori.adventure.text.Component> getJoinMessages()
      Getting a collection of localized messages reporting entry into a region..
      The key is the localization tag.
    • getExitMessage

      Optional<net.kyori.adventure.text.Component> getExitMessage(Locale locale)
      Getting region exit message.
      If the specified localization is not found, the default localization will be checked.
      If no default localization is found, the first value found will be returned or an empty optional value if the list is empty.
      Parameters:
      locale - - checking locale
    • setExitMessage

      Region setExitMessage(net.kyori.adventure.text.Component message, Locale locale)
      Setting region exit message.
      Parameters:
      message - - setting message
      locale - - setting locale
    • getExitMessages

      Map<String,net.kyori.adventure.text.Component> getExitMessages()
      Getting a collection of localized messages reporting region exits.
      The key is the localization tag.
    • getAdditionalData

      <T extends AdditionalData> Optional<T> getAdditionalData(org.spongepowered.plugin.PluginContainer container, String dataName, Class<T> clazz)
      Getting additional data that is created by other plugins.
      After getting the data, they must be converted to the desired type.
      Exemple: YourDataClass yourDataClass = (YourDataClass) additionalData;
    • setAdditionalData

      <T extends AdditionalData> Region setAdditionalData(org.spongepowered.plugin.PluginContainer container, String dataName, T additionalData)
      Write additional data created by another plugin.
    • removeAdditionalData

      Region removeAdditionalData(org.spongepowered.plugin.PluginContainer container, String dataName)
      Deleting additional data created by another plugin.
    • getAllAdditionalData

      Map<String,Map<String,com.google.gson.JsonObject>> getAllAdditionalData()
      Getting a copy of the entire collection of the region's supplementary data.
    • isIntersectsWith

      boolean isIntersectsWith(org.spongepowered.api.world.server.ServerWorld serverWorld, org.spongepowered.math.vector.Vector3i vector3i)
      Checking whether the position belongs to the region.
      Parameters:
      serverWorld - - checkable World
      vector3i - - checkable position
    • isIntersectsWith

      boolean isIntersectsWith(org.spongepowered.api.ResourceKey worldkey, org.spongepowered.math.vector.Vector3i vector3i)
      Checking whether the position belongs to the region.
      Parameters:
      worldkey - - checkable World
      vector3i - - checkable position
    • isIntersectsWith

      boolean isIntersectsWith(org.spongepowered.math.vector.Vector3i vector3i)
      Checking whether the position belongs to the region. This method should only be applied to child regions, as it does not perform a world matching check.
      Parameters:
      vector3i - - checkable position
    • getLoadedChunks

      List<org.spongepowered.api.world.chunk.WorldChunk> getLoadedChunks()
      Getting a list of loaded chunks.
      This operation can work overload the server. It is recommended to use in asynchronous mode.
    • getBlocks

      List<org.spongepowered.api.block.BlockState> getBlocks()
      Getting a list of blocks in the region.
      This operation can work overload the server. It is recommended to use in asynchronous mode.
    • getBlockEntities

      List<org.spongepowered.api.block.entity.BlockEntity> getBlockEntities()
      Getting a list of block entities in the region.
      This operation can work overload the server. It is recommended to use in asynchronous mode.
    • getEntities

      List<org.spongepowered.api.entity.Entity> getEntities()
      Getting a list of entities in the region.
      This list will not contain players.
      This operation can work overload the server. It is recommended to use in asynchronous mode.
    • getPlayers

      List<org.spongepowered.api.entity.living.player.server.ServerPlayer> getPlayers()
      Getting a list of players in the region.
      This operation can work overload the server. It is recommended to use in asynchronous mode.
    • getChunkNumbers

      List<ChunkNumber> getChunkNumbers()
      Getting a list of the chunk numbers that the region occupies.
    • getSchematic

      Optional<org.spongepowered.api.world.schematic.Schematic> getSchematic(String schematicName, String altAuthor)
      Create a Schematic from the region.
      This operation can work overload the server. It is recommended to use in asynchronous mode.
    • putSchematic

      boolean putSchematic(org.spongepowered.api.world.schematic.Schematic schematic, int heigt)
      Insert Schematic into the region.

      This operation can work overload the server.
      Parameters:
      schematic -
      heigt - - the height at which the insertion will be made
    • putSchematic

      boolean putSchematic(org.spongepowered.api.world.schematic.Schematic schematic, org.spongepowered.math.vector.Vector3i vector3i)
      Insert Schematic into the region.

      This operation can work overload the server.
      Parameters:
      schematic -
      vector3i - - central position
    • regen

      boolean regen(boolean async, int delay)
      Territory regeneration in the region.
      Parameters:
      async - - regen in async mode
      delay - - delay before regeneration in async mode
    • equalsOwners

      boolean equalsOwners(Region region)
      Checking for matching region owners.
    • copy

      Region copy()
      Create a copy of the current region.