Class WorldCoord
java.lang.Object
com.palmergames.bukkit.towny.object.Coord
com.palmergames.bukkit.towny.object.WorldCoord
- Direct Known Subclasses:
CellBorder
-
Constructor Summary
ConstructorsConstructorDescriptionWorldCoord(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) booleanstatic booleancellChanged(org.bukkit.Location from, org.bukkit.Location to) Checks that locations are in different cells without allocating any garbage to the heap.booleancontainsCoordinate(double x, double z) booleancontainsCoordinate(int x, int z) booleancontainsLocation(org.bukkit.Location location) Checks if the given location is located inside of this WorldCoord.booleanorg.bukkit.util.BoundingBox@Nullable org.bukkit.WorldShortcut 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.LocationShortcut for TownyUniverse.getInstance().getTownBlock(WorldCoord).@Nullable TownBlockRelatively safe to use ifhasTownBlock()has already been checked and returned true.@Nullable TownRelatively safe to use ifhasTownBlock()has already been used.@Nullable TownyWorldorg.bukkit.LocationinthashCode()booleanbooleanbooleanbooleanIdentical to !voidLoads the chunks represented by a WorldCoord.static WorldCoordparseWorldCoord(String worldName, int blockX, int blockZ) static WorldCoordparseWorldCoord(org.bukkit.block.Block block) static WorldCoordparseWorldCoord(org.bukkit.block.BlockState blockState) static WorldCoordparseWorldCoord(org.bukkit.entity.Entity entity) static WorldCoordparseWorldCoord(org.bukkit.Location loc) toString()voidUnloads the chunks presented by a WorldCoord.Methods inherited from class 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
-
parseWorldCoord
-
add
-
hashCode
-
equals
-
toString
-
getBukkitWorld
@Nullable public @Nullable org.bukkit.World getBukkitWorld()Shortcut for Bukkit.getWorld(worldName)- Returns:
- the relevant
Worldinstance
-
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. -
unloadChunks
public void unloadChunks()Unloads the chunks presented by a WorldCoord. Removes a PluginChunkTicket so that the WorldCoord will no longer remain loaded. -
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
-
containsLocation
public boolean containsLocation(org.bukkit.Location location) Checks if the given location is located inside of this WorldCoord.- Parameters:
location- The location to check.- Returns:
- Whether the location is contained inside of this WorldCoord.
-
containsCoordinate
public boolean containsCoordinate(double x, double z) -
containsCoordinate
public boolean containsCoordinate(int x, int z) -
getCardinallyAdjacentWorldCoords
-
canBeStolen
public boolean canBeStolen()
-