Class WorldCoord
java.lang.Object
com.palmergames.bukkit.towny.object.Coord
com.palmergames.bukkit.towny.object.WorldCoord
- Direct Known Subclasses:
CellBorder
-
Constructor Summary
ConstructorDescriptionWorldCoord
(WorldCoord worldCoord) WorldCoord
(String worldName, int x, int z) WorldCoord
(String worldName, Coord coord) WorldCoord
(String worldName, UUID worldUUID, int x, int z) WorldCoord
(String worldName, UUID worldUUID, Coord coord) WorldCoord
(@NotNull org.bukkit.World world, int x, int z) WorldCoord
(@NotNull org.bukkit.World world, Coord coord) -
Method Summary
Modifier and TypeMethodDescriptionadd
(int xOffset, int zOffset) boolean
static boolean
cellChanged
(org.bukkit.Location from, org.bukkit.Location to) Checks that locations are in different cells without allocating any garbage to the heap.boolean
org.bukkit.util.BoundingBox
@Nullable org.bukkit.World
Shortcut for Bukkit.getWorld(worldName)getCardinallyAdjacentWorldCoords
(boolean... includeOrdinalFlag) protected Collection
<Pair<Integer, Integer>> protected Collection
<Pair<Integer, Integer>> getChunkPositions
(int cellSize) @Unmodifiable Collection
<CompletableFuture<org.bukkit.Chunk>> Loads and returns the chunk(s) inside this WorldCoord.getCoord()
org.bukkit.Location
Shortcut for TownyUniverse.getInstance().getTownBlock(WorldCoord).@Nullable TownBlock
Relatively safe to use ifhasTownBlock()
has already been checked and returned true.@Nullable Town
Relatively safe to use ifhasTownBlock()
has already been used.@Nullable TownyWorld
org.bukkit.Location
int
hashCode()
boolean
boolean
boolean
boolean
Identical to !void
Loads the chunks represented by a WorldCoord.static WorldCoord
parseWorldCoord
(String worldName, int blockX, int blockZ) static WorldCoord
parseWorldCoord
(org.bukkit.block.Block block) static WorldCoord
parseWorldCoord
(org.bukkit.entity.Entity entity) static WorldCoord
parseWorldCoord
(org.bukkit.Location loc) toString()
void
Unloads the chunks presented by a WorldCoord.Methods inherited from class com.palmergames.bukkit.towny.object.Coord
getCellSize, getX, getZ, parseCoord, parseCoord, parseCoord, parseCoord, toCell
-
Constructor Details
-
WorldCoord
-
WorldCoord
-
WorldCoord
-
WorldCoord
-
WorldCoord
public WorldCoord(@NotNull @NotNull org.bukkit.World world, int x, int z) -
WorldCoord
-
WorldCoord
-
-
Method Details
-
getWorldName
-
getCoord
-
parseWorldCoord
-
parseWorldCoord
-
parseWorldCoord
-
parseWorldCoord
-
add
-
hashCode
public int hashCode() -
equals
-
toString
-
getBukkitWorld
@Nullable public @Nullable org.bukkit.World getBukkitWorld()Shortcut for Bukkit.getWorld(worldName)- Returns:
- the relevant
World
instance
-
getTownyWorld
- Returns:
- the relevant TownyWorld instance or null.
-
getTownBlock
Shortcut for TownyUniverse.getInstance().getTownBlock(WorldCoord).- Returns:
- the relevant TownBlock instance.
- Throws:
NotRegisteredException
- If there is no TownBlock at this WorldCoord.
-
getTownBlockOrNull
Relatively safe to use ifhasTownBlock()
has already been checked and returned true.- Returns:
- TownBlock at this WorldCoord or null;
-
hasTownBlock
public boolean hasTownBlock() -
hasTown
-
isWilderness
public boolean isWilderness()Identical to !hasTownBlock()
, but is better readable.- Returns:
- Whether this townblock is not claimed.
-
loadChunks
public void loadChunks()Loads the chunks represented by a WorldCoord. Creates a PluginChunkTicket so that the WorldCoord will remain loaded, even when no players are present.Uses PaperLib's getChunkAtAsync when Paper is present.
-
unloadChunks
public void unloadChunks()Unloads the chunks presented by a WorldCoord. Removes a PluginChunkTicket so that the WorldCoord will no longer remain loaded.Uses PaperLib's getChunkAtAsync when Paper is present.
-
getChunks
Loads and returns the chunk(s) inside this WorldCoord.Chunks are loaded async on servers using paper.
- Returns:
- An unmodifiable collection of chunk futures.
-
getChunkPositions
-
getChunkPositions
- Parameters:
cellSize
- The currentCoord.getCellSize()
- Returns:
- A collection of all chunk coords that are contained within this worldcoord for the given cell size
-
isFullyLoaded
public boolean isFullyLoaded()- Returns:
- Whether all chunks contained in this worldcoord are loaded.
-
getBoundingBox
public org.bukkit.util.BoundingBox getBoundingBox()- Returns:
- Return a Bukkit bounding box containg the space of the WorldCoord.
-
getLowerMostCornerLocation
public org.bukkit.Location getLowerMostCornerLocation()- Returns:
- Location of the lower-most corner of a WorldCoord.
-
getUpperMostCornerLocation
public org.bukkit.Location getUpperMostCornerLocation()- Returns:
- Location of the upper-most corner of a WorldCoord.
-
getTownOrNull
Relatively safe to use ifhasTownBlock()
has already been used.- Returns:
- Town at this WorldCoord or null;
-
cellChanged
public static boolean cellChanged(org.bukkit.Location from, org.bukkit.Location to) Checks that locations are in different cells without allocating any garbage to the heap.- Parameters:
from
- Original locationto
- Next location- Returns:
- whether the locations are in different cells
-
getCardinallyAdjacentWorldCoords
-
canBeStolen
public boolean canBeStolen()
-