Package com.plotsquared.core.util
Class WorldUtil
java.lang.Object
com.plotsquared.core.util.WorldUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidGet the biome in a given chunk, asynchronouslygetBiomeSynchronous(@NonNull String world, int x, int z) Deprecated.abstract voidGet the block at a given location (asynchronously)abstract @NonNull BlockStategetBlockSynchronous(@NonNull Location location) Deprecated.getChunkChunks(String world) abstract @NonNull StringComparison<BlockState>.ComparisonResultgetClosestBlock(@NonNull String name) Get a string comparison with the closets block state matching a given stringabstract @org.checkerframework.checker.index.qual.NonNegative intgetFoodLevel(@NonNull PlotPlayer<?> player) Get the player food levelabstract @org.checkerframework.checker.index.qual.NonNegative doublegetHealth(@NonNull PlotPlayer<?> player) Get the player healthabstract voidgetHighestBlock(@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 intgetHighestBlockSynchronous(@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 intgetTileEntityCount(@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 WorldEditWorldcorresponding to a world nameabstract booleanisBlockSame(@NonNull BlockState block1, @NonNull BlockState block2) Check if two blocks are the same type)abstract booleanCheck if a given world name corresponds to a real worldabstract voidrefreshChunk(int x, int z, String world) Refresh (resend) chunk to player.abstract voidSave a worldstatic voidSet the biome in a regionabstract voidSet the biome in a regionabstract voidsetFoodLevel(@NonNull PlotPlayer<?> player, @org.checkerframework.checker.index.qual.NonNegative int foodLevel) Set the player food levelabstract voidsetHealth(@NonNull PlotPlayer<?> player, @org.checkerframework.checker.index.qual.NonNegative double health) Set the player healthabstract voidsetSign(@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 voidSet the world spawn locationvoidupload(@NonNull Plot plot, @Nullable UUID uuid, @Nullable String file, @NonNull RunnableVal<URL> whenDone)
-
Constructor Details
-
WorldUtil
public WorldUtil()
-
-
Method Details
-
setBiome
Set the biome in a region- Parameters:
world- World namep1x- Min Xp1z- Min Zp2x- Max Xp2z- Max Zbiome- Biome
-
isWorld
Check if a given world name corresponds to a real world- Parameters:
worldName- World name- Returns:
trueif there exists a world with the given world name,falseif 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
-
setSign
public abstract 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 text- Parameters:
location- Block locationlines- Sign textreplacements- Text replacements
-
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 abstract void setBiomes(@NonNull String world, @NonNull CuboidRegion region, @NonNull BiomeType biome) Set the biome in a region- Parameters:
world- World nameregion- Regionbiome- New biome
-
getWeWorld
Get the WorldEditWorldcorresponding 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
-
getChunkChunks
-
isBlockSame
Check if two blocks are the same type)- Parameters:
block1- First blockblock2- Second block- Returns:
trueif the blocks have the same type,falseif 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)