Package com.plotsquared.core.util
Class WorldUtil
java.lang.Object
com.plotsquared.core.util.WorldUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
Get the biome in a given chunk, asynchronouslygetBiomeSynchronous
(@NonNull String world, int x, int z) Deprecated.abstract void
Get the block at a given location (asynchronously)abstract @NonNull BlockState
getBlockSynchronous
(@NonNull Location location) Deprecated.getChunkChunks
(String world) abstract @NonNull StringComparison<BlockState>.ComparisonResult
getClosestBlock
(@NonNull String name) Get a string comparison with the closets block state matching a given stringabstract @org.checkerframework.checker.index.qual.NonNegative int
getFoodLevel
(@NonNull PlotPlayer<?> player) Get the player food levelabstract @org.checkerframework.checker.index.qual.NonNegative double
getHealth
(@NonNull PlotPlayer<?> player) Get the player healthabstract void
getHighestBlock
(@NonNull String world, int x, int z, @NonNull IntConsumer result) Get the Y coordinate of the highest non-air block in the world, asynchronouslyabstract @org.checkerframework.checker.index.qual.NonNegative int
getHighestBlockSynchronous
(@NonNull String world, int x, int z) Deprecated.getSignSynchronous
(@NonNull Location location) Deprecated.May result in synchronous chunk loadingGet the world spawn locationabstract @org.checkerframework.checker.index.qual.NonNegative int
getTileEntityCount
(@NonNull String world, @NonNull BlockVector2 chunk) Get the tile entity count in a chunkabstract @NonNull Collection<BlockType>
Get all recognized tile entity typesabstract @NonNull Set<EntityType>
getTypesInCategory
(@NonNull String category) Get all entity types belonging to an entity categorygetWeWorld
(@NonNull String world) Get the WorldEditWorld
corresponding to a world nameabstract boolean
isBlockSame
(@NonNull BlockState block1, @NonNull BlockState block2) Check if two blocks are the same type)abstract boolean
Check if a given world name corresponds to a real worldabstract void
refreshChunk
(int x, int z, String world) Refresh (resend) chunk to player.abstract void
Save a worldstatic void
Deprecated, for removal: This API element is subject to removal in a future version.static void
setBiome
(String world, CuboidRegion region, BiomeType biome) Set the biome in a regionvoid
Set the biome in a regionabstract void
setFoodLevel
(@NonNull PlotPlayer<?> player, @org.checkerframework.checker.index.qual.NonNegative int foodLevel) Set the player food levelabstract void
setHealth
(@NonNull PlotPlayer<?> player, @org.checkerframework.checker.index.qual.NonNegative double health) Set the player healthabstract void
setSign
(@NonNull Location location, @NonNull Caption[] lines, @NonNull net.kyori.adventure.text.minimessage.Template... replacements) Set the block at the specified location to a sign, with given textabstract void
Set the world spawn locationvoid
upload
(@NonNull Plot plot, @Nullable UUID uuid, @Nullable String file, @NonNull RunnableVal<URL> whenDone) Deprecated, for removal: This API element is subject to removal in a future version.
-
Constructor Details
-
WorldUtil
public WorldUtil()
-
-
Method Details
-
setBiome
@Deprecated(forRemoval=true) public static void setBiome(String world, int p1x, int p1z, int p2x, int p2z, BiomeType biome) Deprecated, for removal: This API element is subject to removal in a future version.Set the biome in a region- Parameters:
world
- World namep1x
- Min Xp1z
- Min Zp2x
- Max Xp2z
- Max Zbiome
- Biome
-
setBiome
Set the biome in a region- Parameters:
world
- World nameregion
- Regionbiome
- Biome- Since:
- 6.6.0
-
isWorld
Check if a given world name corresponds to a real world- Parameters:
worldName
- World name- Returns:
true
if there exists a world with the given world name,false
if not
-
getSignSynchronous
Deprecated.May result in synchronous chunk loading- Parameters:
location
- Sign location- Returns:
- Sign content (or an empty string array if the block is not a sign)
-
getSpawn
Get the world spawn location- Parameters:
world
- World name- Returns:
- World spawn location
-
setSpawn
Set the world spawn location- Parameters:
location
- New spawn
-
saveWorld
Save a world- Parameters:
world
- World name
-
getClosestBlock
public abstract @NonNull StringComparison<BlockState>.ComparisonResult getClosestBlock(@NonNull String name) Get a string comparison with the closets block state matching a given string- Parameters:
name
- Block name- Returns:
- Comparison result containing the closets matching block
-
getBiome
public abstract void getBiome(@NonNull String world, int x, int z, @NonNull Consumer<BiomeType> result) Get the biome in a given chunk, asynchronously- Parameters:
world
- Worldx
- Chunk X coordinatez
- Chunk Z coordinateresult
- Result consumer
-
getBiomeSynchronous
@Deprecated public abstract @NonNull BiomeType getBiomeSynchronous(@NonNull String world, int x, int z) Deprecated.Get the biome in a given chunk, asynchronously- Parameters:
world
- Worldx
- Chunk X coordinatez
- Chunk Z coordinate- Returns:
- Biome
-
getBlock
Get the block at a given location (asynchronously)- Parameters:
location
- Block locationresult
- Result consumer
-
getBlockSynchronous
Deprecated.Get the block at a given location (synchronously)- Parameters:
location
- Block location- Returns:
- Result
-
getHighestBlock
public abstract void getHighestBlock(@NonNull String world, int x, int z, @NonNull IntConsumer result) Get the Y coordinate of the highest non-air block in the world, asynchronously- Parameters:
world
- World namex
- X coordinatez
- Z coordinateresult
- Result consumer
-
getHighestBlockSynchronous
@Deprecated public abstract @org.checkerframework.checker.index.qual.NonNegative int getHighestBlockSynchronous(@NonNull String world, int x, int z) Deprecated.Get the Y coordinate of the highest non-air block in the world, synchronously- Parameters:
world
- World namex
- X coordinatez
- Z coordinate- Returns:
- Result
-
setBiomes
public void setBiomes(@NonNull String worldName, @NonNull CuboidRegion region, @NonNull BiomeType biome) Set the biome in a region- Parameters:
worldName
- World nameregion
- Regionbiome
- New biome
-
getWeWorld
Get the WorldEditWorld
corresponding to a world name- Parameters:
world
- World name- Returns:
- World object
-
refreshChunk
Refresh (resend) chunk to player. Usually after setting the biome- Parameters:
x
- Chunk x locationz
- Chunk z locationworld
- World of the chunk
-
upload
@Deprecated(forRemoval=true, since="6.11.0") public void upload(@NonNull Plot plot, @Nullable UUID uuid, @Nullable String file, @NonNull RunnableVal<URL> whenDone) Deprecated, for removal: This API element is subject to removal in a future version.The legacy web interface is deprecated for removal in favor of Arkitektonika. -
getChunkChunks
-
isBlockSame
Check if two blocks are the same type)- Parameters:
block1
- First blockblock2
- Second block- Returns:
true
if the blocks have the same type,false
if not
-
getHealth
public abstract @org.checkerframework.checker.index.qual.NonNegative double getHealth(@NonNull PlotPlayer<?> player) Get the player health- Parameters:
player
- Player- Returns:
- Non-negative health
-
setHealth
public abstract void setHealth(@NonNull PlotPlayer<?> player, @org.checkerframework.checker.index.qual.NonNegative double health) Set the player health- Parameters:
player
- Player healthhealth
- Non-negative health
-
getFoodLevel
public abstract @org.checkerframework.checker.index.qual.NonNegative int getFoodLevel(@NonNull PlotPlayer<?> player) Get the player food level- Parameters:
player
- Player- Returns:
- Non-negative food level
-
setFoodLevel
public abstract void setFoodLevel(@NonNull PlotPlayer<?> player, @org.checkerframework.checker.index.qual.NonNegative int foodLevel) Set the player food level- Parameters:
player
- Player food levelfoodLevel
- Non-negative food level
-
getTypesInCategory
Get all entity types belonging to an entity category- Parameters:
category
- Entity category- Returns:
- Set containing all entities belonging to the given category
-
getTileEntityTypes
Get all recognized tile entity types- Returns:
- Collection containing all known tile entity types
-
getTileEntityCount
public abstract @org.checkerframework.checker.index.qual.NonNegative int getTileEntityCount(@NonNull String world, @NonNull BlockVector2 chunk) Get the tile entity count in a chunk- Parameters:
world
- Worldchunk
- Chunk coordinates- Returns:
- Tile entity count
-
getBiome(String, int, int, Consumer)