Package com.plotsquared.core.util
Class WorldUtil
java.lang.Object
com.plotsquared.core.util.WorldUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
getBiome(@NonNull String world, int x, int z, @NonNull Consumer<com.sk89q.worldedit.world.biome.BiomeType> result)
Get the biome in a given chunk, asynchronouslyabstract @NonNull com.sk89q.worldedit.world.biome.BiomeType
getBiomeSynchronous(@NonNull String world, int x, int z)
Deprecated.abstract void
getBlock(@NonNull Location location, @NonNull Consumer<com.sk89q.worldedit.world.block.BlockState> result)
Get the block at a given location (asynchronously)abstract @NonNull com.sk89q.worldedit.world.block.BlockState
getBlockSynchronous(@NonNull Location location)
Deprecated.Set<com.sk89q.worldedit.math.BlockVector2>
getChunkChunks(String world)
abstract StringComparison.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.abstract @NonNull String[]
getSignSynchronous(@NonNull Location location)
Deprecated.May result in synchronous chunk loadingabstract @NonNull Location
Get the world spawn locationabstract @org.checkerframework.checker.index.qual.NonNegative int
getTileEntityCount(@NonNull String world, @NonNull com.sk89q.worldedit.math.BlockVector2 chunk)
Get the tile entity count in a chunkabstract @NonNull Collection<com.sk89q.worldedit.world.block.BlockType>
Get all recognized tile entity typesabstract @NonNull Set<com.sk89q.worldedit.world.entity.EntityType>
getTypesInCategory(@NonNull String category)
Get all entity types belonging to an entity categoryabstract @NonNull com.sk89q.worldedit.world.World
getWeWorld(@NonNull String world)
Get the WorldEditWorld
corresponding to a world nameabstract boolean
isBlockSame(@NonNull com.sk89q.worldedit.world.block.BlockState block1, @NonNull com.sk89q.worldedit.world.block.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
setBiome(String world, int p1x, int p1z, int p2x, int p2z, com.sk89q.worldedit.world.biome.BiomeType biome)
Set the biome in a regionabstract void
setBiomes(@NonNull String world, @NonNull com.sk89q.worldedit.regions.CuboidRegion region, @NonNull com.sk89q.worldedit.world.biome.BiomeType biome)
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)
-
Constructor Details
-
WorldUtil
public WorldUtil()
-
-
Method Details
-
setBiome
public static void setBiome(String world, int p1x, int p1z, int p2x, int p2z, com.sk89q.worldedit.world.biome.BiomeType biome)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:
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
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<com.sk89q.worldedit.world.biome.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 com.sk89q.worldedit.world.biome.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
public abstract void getBlock(@NonNull Location location, @NonNull Consumer<com.sk89q.worldedit.world.block.BlockState> result)Get the block at a given location (asynchronously)- Parameters:
location
- Block locationresult
- Result consumer
-
getBlockSynchronous
@Deprecated public abstract @NonNull com.sk89q.worldedit.world.block.BlockState getBlockSynchronous(@NonNull Location location)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 com.sk89q.worldedit.regions.CuboidRegion region, @NonNull com.sk89q.worldedit.world.biome.BiomeType biome)Set the biome in a region- Parameters:
world
- 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
public void upload(@NonNull Plot plot, @Nullable UUID uuid, @Nullable String file, @NonNull RunnableVal<URL> whenDone) -
getChunkChunks
-
isBlockSame
public abstract boolean isBlockSame(@NonNull com.sk89q.worldedit.world.block.BlockState block1, @NonNull com.sk89q.worldedit.world.block.BlockState block2)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
public abstract @NonNull Set<com.sk89q.worldedit.world.entity.EntityType> getTypesInCategory(@NonNull String category)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 com.sk89q.worldedit.math.BlockVector2 chunk)Get the tile entity count in a chunk- Parameters:
world
- Worldchunk
- Chunk coordinates- Returns:
- Tile entity count
-
getBiome(String, int, int, Consumer)