Interface World
- All Superinterfaces:
Audience
,ForwardingAudience
,Keyed
,Metadatable
,PluginMessageRecipient
,Pointered
,RegionAccessor
,WorldInfo
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Deprecated.Use either the Future or the Consumer based methodsstatic class
Represents various map environment types that a world may bestatic class
Nested classes/interfaces inherited from interface net.kyori.adventure.audience.ForwardingAudience
ForwardingAudience.Single
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addPluginChunkTicket(int x, int z, @NotNull Plugin plugin)
Adds a plugin ticket for the specified chunk, loading the chunk if it is not already loaded.Gets the audiences.boolean
Gets whether or not structures are being generated.boolean
createExplosion(double x, double y, double z, float power)
Creates explosion at given coordinates with given powerboolean
createExplosion(double x, double y, double z, float power, boolean setFire)
Creates explosion at given coordinates with given power and optionally setting blocks on fire.boolean
createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks)
Creates explosion at given coordinates with given power and optionally setting blocks on fire or breaking blocks.boolean
createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, @Nullable Entity source)
Creates explosion at given coordinates with given power and optionally setting blocks on fire or breaking blocks.default boolean
createExplosion(@NotNull Entity source, float power)
Creates explosion at given entities location with given power and optionally setting blocks on fire, with the specified entity as the source.default boolean
createExplosion(@NotNull Entity source, float power, boolean setFire)
Creates explosion at given entities location with given power and optionally setting blocks on fire, with the specified entity as the source.default boolean
createExplosion(@NotNull Entity source, float power, boolean setFire, boolean breakBlocks)
Creates explosion at given entities location with given power and optionally setting blocks on fire, with the specified entity as the source.boolean
createExplosion(@NotNull Location loc, float power)
Creates explosion at given coordinates with given powerboolean
createExplosion(@NotNull Location loc, float power, boolean setFire)
Creates explosion at given coordinates with given power and optionally setting blocks on fire.boolean
createExplosion(@NotNull Location loc, float power, boolean setFire, boolean breakBlocks)
Creates explosion at given coordinates with given power and optionally setting blocks on fire or breaking blocks.boolean
createExplosion(@NotNull Location loc, float power, boolean setFire, boolean breakBlocks, @Nullable Entity source)
Creates explosion at given coordinates with given power and optionally setting blocks on fire or breaking blocks.default boolean
createExplosion(@Nullable Entity source, @NotNull Location loc, float power)
Creates explosion at given location with given power, with the specified entity as the source.default boolean
createExplosion(@Nullable Entity source, @NotNull Location loc, float power, boolean setFire)
Creates explosion at given location with given power and optionally setting blocks on fire, with the specified entity as the source.boolean
createExplosion(@Nullable Entity source, @NotNull Location loc, float power, boolean setFire, boolean breakBlocks)
Creates explosion at given location with given power and optionally setting blocks on fire, with the specified entity as the source.boolean
Deprecated.useisBedWorks()
boolean
Deprecated.Drops an item at the specifiedLocation
Drops an item at the specifiedLocation
Note that functions will run before the entity is spawneddropItemNaturally(@NotNull Location location, @NotNull ItemStack item)
Drops an item at the specifiedLocation
with a random offsetdropItemNaturally(@NotNull Location location, @NotNull ItemStack item, @Nullable Consumer<Item> function)
Drops an item at the specifiedLocation
with a random offset Note that functions will run before the entity is spawnedfindLightningRod(@NotNull Location location)
Finds the location of the nearest unobstructed Lightning Rod in a 128-block radius around the given location.findLightningTarget(@NotNull Location location)
Finds a targetLocation
for lightning to strike.boolean
generateTree(@NotNull Location location, @NotNull TreeType type)
Creates a tree at the givenLocation
boolean
generateTree(@NotNull Location loc, @NotNull TreeType type, @NotNull BlockChangeDelegate delegate)
Deprecated.this method does not handle tile entities (bee nests)boolean
Gets whether animals can spawn in this world.boolean
Gets whether monsters can spawn in this world.int
Gets the limit for number of ambient mobs that can spawn in a chunk in this worldint
Gets the limit for number of animals that can spawn in a chunk in this worldgetBiome(int x, int z)
Deprecated.biomes are now 3-dimensionalGets the biome provider for this worldgetBlockAt(int x, int y, int z)
Gets theBlock
at the given coordinatesgetBlockAt(@NotNull Location location)
getBlockAtKey(long key)
Gets theBlock
at the given block keygetChunkAt(int x, int z)
Gets theChunk
at the given coordinatesgetChunkAt(long chunkKey)
Gets the chunk at the specified chunk key, which is the X and Z packed into a long.getChunkAt(@NotNull Block block)
getChunkAt(@NotNull Location location)
default CompletableFuture<Chunk>
getChunkAtAsync(int x, int z)
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time.default CompletableFuture<Chunk>
getChunkAtAsync(int x, int z, boolean gen)
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time.getChunkAtAsync(int x, int z, boolean gen, boolean urgent)
default void
getChunkAtAsync(int x, int z, boolean gen, Consumer<Chunk> cb)
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time.default void
getChunkAtAsync(int x, int z, @NotNull World.ChunkLoadCallback cb)
Deprecated.Use either the Future or the Consumer based methodsdefault void
getChunkAtAsync(int x, int z, Consumer<Chunk> cb)
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time.default CompletableFuture<Chunk>
getChunkAtAsync(@NotNull Block block)
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time.default CompletableFuture<Chunk>
getChunkAtAsync(@NotNull Block block, boolean gen)
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time.default void
getChunkAtAsync(@NotNull Block block, boolean gen, Consumer<Chunk> cb)
default void
getChunkAtAsync(@NotNull Block block, @NotNull World.ChunkLoadCallback cb)
Deprecated.Use either the Future or the Consumer based methodsdefault void
getChunkAtAsync(@NotNull Block block, Consumer<Chunk> cb)
default CompletableFuture<Chunk>
getChunkAtAsync(@NotNull Location loc)
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time.default CompletableFuture<Chunk>
getChunkAtAsync(@NotNull Location loc, boolean gen)
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time.default void
getChunkAtAsync(@NotNull Location loc, boolean gen, Consumer<Chunk> cb)
default void
Deprecated.Use either the Future or the Consumer based methodsdefault void
getChunkAtAsync(@NotNull Location loc, Consumer<Chunk> cb)
default CompletableFuture<Chunk>
getChunkAtAsyncUrgently(int x, int z)
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time.default CompletableFuture<Chunk>
getChunkAtAsyncUrgently(@NotNull Block block)
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time.default CompletableFuture<Chunk>
getChunkAtAsyncUrgently(@NotNull Block block, boolean gen)
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time.default CompletableFuture<Chunk>
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time.default CompletableFuture<Chunk>
getChunkAtAsyncUrgently(@NotNull Location loc, boolean gen)
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time.int
int
Get the clear weather duration.double
Gets the coordinate scaling of this world.Gets the Difficulty of the world.getEmptyChunkSnapshot(int x, int z, boolean includeBiome, boolean includeBiomeTemp)
Get empty chunk snapshot (equivalent to all air blocks), optionally including valid biome data.Get theDragonBattle
associated with this world.Get a list of all entities in this World<T extends Entity>
@NotNull Collection<T>getEntitiesByClass(@NotNull Class<T> cls)
Get a collection of all entities in this World matching the given class/interface<T extends Entity>
@NotNull Collection<T>getEntitiesByClass(@NotNull Class<T>... classes)
Deprecated.getEntitiesByClasses(@NotNull Class<?>... classes)
Get a collection of all entities in this World matching any of the given classes/interfacesGets an entity in this world by its UUIDint
Returns all force loaded chunks in this world.long
Gets the full in-game time on this world<T> T
getGameRuleDefault(@NotNull GameRule<T> rule)
Get the default value for a givenGameRule
.Get an array containing the names of all theGameRule
s.<T> T
getGameRuleValue(@NotNull GameRule<T> rule)
Get the current value for a givenGameRule
.getGameRuleValue(@Nullable String rule)
Deprecated.usegetGameRuleValue(GameRule)
insteadlong
Gets the full in-game time on this world since the world generationGets the chunk generator for this worldgetHighestBlockAt(int x, int z)
Gets the highest non-empty (impassable) block at the given coordinates.getHighestBlockAt(int x, int z, @NotNull HeightMap heightMap)
Gets the highest block corresponding to theHeightMap
at the given coordinates.getHighestBlockAt(int x, int z, HeightmapType heightmap)
Deprecated.Upstream has added support for this, usegetHighestBlockAt(int, int, HeightMap)
getHighestBlockAt(@NotNull Location location)
Gets the highest non-empty (impassable) block at the given coordinates.getHighestBlockAt(@NotNull Location location, @NotNull HeightMap heightMap)
Gets the highest block corresponding to theHeightMap
at the given coordinates.getHighestBlockAt(@NotNull Location location, HeightmapType heightmap)
Deprecated.Upstream has added support for this, usegetHighestBlockAt(Location, HeightMap)
int
getHighestBlockYAt(int x, int z)
Gets the highest non-empty (impassable) coordinate at the given coordinates.int
getHighestBlockYAt(int x, int z, @NotNull HeightMap heightMap)
Gets the highest coordinate corresponding to theHeightMap
at the given coordinates.int
getHighestBlockYAt(int x, int z, HeightmapType heightmap)
Deprecated.Upstream has added support for this, usegetHighestBlockYAt(int, int, HeightMap)
int
getHighestBlockYAt(@NotNull Location location)
Gets the highest non-empty (impassable) coordinate at the givenLocation
.int
getHighestBlockYAt(@NotNull Location location, @NotNull HeightMap heightMap)
default int
getHighestBlockYAt(@NotNull Location location, HeightmapType heightmap)
Deprecated.Upstream has added support for this, usegetHighestBlockYAt(Location, HeightMap)
double
getHumidity(int x, int z)
Deprecated.biomes are now 3-dimensionaldouble
getHumidity(int x, int y, int z)
Gets the humidity for the given block coordinates.Gets the collection of materials that burn infinitely in this world.boolean
Gets whether the world's spawn area should be kept loaded into memory or not.getKey()
Get the world's keyGet a list of all living entities in this WorldGets an array of all loadedChunk
sgetLocationAtKey(long key)
Gets theLocation
at the given block keyint
Gets the maximum height to which chorus fruits and nether portals can bring players within this dimension.int
Gets limit for number of monsters that can spawn in a chunk in this worldgetNearbyEntities(@NotNull Location location, double x, double y, double z)
Returns a list of entities within a bounding box centered around a Location.getNearbyEntities(@NotNull Location location, double x, double y, double z, @Nullable Predicate<Entity> filter)
Returns a list of entities within a bounding box centered around a Location.getNearbyEntities(@NotNull BoundingBox boundingBox)
Returns a list of entities within the given bounding box.getNearbyEntities(@NotNull BoundingBox boundingBox, @Nullable Predicate<Entity> filter)
Returns a list of entities within the given bounding box.default <T extends Entity>
@NotNull Collection<T>getNearbyEntitiesByType(@Nullable Class<? extends Entity> clazz, @NotNull Location loc, double xRadius, double yRadius, double zRadius, @Nullable Predicate<T> predicate)
Gets all nearby entities of the specified type, within the specified radius (bounding box)default <T extends Entity>
@NotNull Collection<T>getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, @NotNull Location loc, double radius)
Gets all nearby entities of the specified type, within the specified radius (bounding box)default <T extends Entity>
@NotNull Collection<T>getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, @NotNull Location loc, double xzRadius, double yRadius)
Gets all nearby entities of the specified type, within the specified radius, with x and x radius matching (bounding box)default <T extends Entity>
@NotNull Collection<T>getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, @NotNull Location loc, double xRadius, double yRadius, double zRadius)
Gets all nearby entities of the specified type, within the specified radius (bounding box)default <T extends Entity>
@NotNull Collection<T>getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, @NotNull Location loc, double xzRadius, double yRadius, @Nullable Predicate<T> predicate)
Gets all nearby entities of the specified type, within the specified radius, with x and x radius matching (bounding box)default <T extends Entity>
@NotNull Collection<T>getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, @NotNull Location loc, double radius, @Nullable Predicate<T> predicate)
Gets all nearby entities of the specified type, within the specified radius (bounding box)default @NotNull Collection<LivingEntity>
getNearbyLivingEntities(@NotNull Location loc, double radius)
Gets nearby players within the specified radius (bounding box)default @NotNull Collection<LivingEntity>
getNearbyLivingEntities(@NotNull Location loc, double xzRadius, double yRadius)
Gets nearby players within the specified radius (bounding box)default @NotNull Collection<LivingEntity>
getNearbyLivingEntities(@NotNull Location loc, double xRadius, double yRadius, double zRadius)
Gets nearby players within the specified radius (bounding box)default @NotNull Collection<LivingEntity>
getNearbyLivingEntities(@NotNull Location loc, double xRadius, double yRadius, double zRadius, @Nullable Predicate<LivingEntity> predicate)
Gets nearby players within the specified radius (bounding box)default @NotNull Collection<LivingEntity>
getNearbyLivingEntities(@NotNull Location loc, double xzRadius, double yRadius, @Nullable Predicate<LivingEntity> predicate)
Gets nearby players within the specified radius (bounding box)default @NotNull Collection<LivingEntity>
getNearbyLivingEntities(@NotNull Location loc, double radius, @Nullable Predicate<LivingEntity> predicate)
Gets nearby players within the specified radius (bounding box)default @NotNull Collection<Player>
getNearbyPlayers(@NotNull Location loc, double radius)
Gets nearby players within the specified radius (bounding box)default @NotNull Collection<Player>
getNearbyPlayers(@NotNull Location loc, double xzRadius, double yRadius)
Gets nearby players within the specified radius (bounding box)default @NotNull Collection<Player>
getNearbyPlayers(@NotNull Location loc, double xRadius, double yRadius, double zRadius)
Gets nearby players within the specified radius (bounding box)default @NotNull Collection<Player>
getNearbyPlayers(@NotNull Location loc, double xRadius, double yRadius, double zRadius, @Nullable Predicate<Player> predicate)
Gets nearby players within the specified radius (bounding box)default @NotNull Collection<Player>
getNearbyPlayers(@NotNull Location loc, double xzRadius, double yRadius, @Nullable Predicate<Player> predicate)
Gets nearby players within the specified radius (bounding box)default @NotNull Collection<Player>
Gets nearby players within the specified radius (bounding box)int
Returns the no-tick view distance for this world.int
Get a list of all players in this WorldReturns a map of which plugins have tickets for what chunks.getPluginChunkTickets(int x, int z)
Retrieves a collection specifying which plugins have tickets for the specified chunk.Gets a list of all appliedBlockPopulator
s for this Worldboolean
getPVP()
Gets the current PVP setting for this world.getRaids()
Gets all raids that are going on over this world.int
Gets the sea level for this world.int
Gets the sending view distance for this world.Gets the default spawnLocation
of this worlddouble
getTemperature(int x, int z)
Deprecated.biomes are now 3-dimensionaldouble
getTemperature(int x, int y, int z)
Gets the temperature for the given block coordinates.int
Get the thundering duration.int
long
Gets the world's ticks per ambient mob spawns valuelong
Gets the world's ticks per animal spawns valuelong
Gets the world's ticks per monster spawns valuelong
Gets the default ticks per water ambient mob spawns value.long
Gets the world's ticks per water mob spawns valuelong
Gets the default ticks per water underground creature spawns value.int
long
getTime()
Gets the relative in-game time of this world.int
Returns the view distance used for this world.int
Gets user-specified limit for number of water ambient mobs that can spawn in a chunk.int
Gets the limit for number of water animals that can spawn in a chunk in this worldint
Gets the limit for number of water underground creature that can spawn in a chunk in this worldint
Get the remaining time in ticks of the current conditions.Gets the world border for this world.Gets the folder of this world on disk.Deprecated.world type is only used to select the default word generation settings and is not stored in Vanilla worlds, making it impossible for this method to always return the correct value.boolean
Deprecated.usehasCeiling()
boolean
Gets if this world has a ceiling.boolean
hasRaids()
Gets if players with the bad omen effect in this world will trigger a raid.boolean
Deprecated.usehasSkyLight()
boolean
Gets if this world has skylight access.boolean
hasStorm()
Returns whether the world has an ongoing storm.boolean
Gets whether or not the world will automatically saveboolean
Gets if beds work in this world.boolean
isChunkForceLoaded(int x, int z)
Gets whether the chunk at the specified chunk coordinates is force loaded.boolean
isChunkGenerated(int x, int z)
Checks if theChunk
at the specified coordinates is generateddefault boolean
isChunkGenerated(long chunkKey)
Checks if aChunk
has been generated at the specified chunk key, which is the X and Z packed into a long.boolean
isChunkInUse(int x, int z)
Deprecated.This method was added to facilitate chunk garbage collection.boolean
isChunkLoaded(int x, int z)
Checks if theChunk
at the specified coordinates is loadedboolean
isChunkLoaded(@NotNull Chunk chunk)
Checks if the specifiedChunk
is loadedboolean
Returns whether the world has clear weather.boolean
Check if it is currently daytime in this worldboolean
Checks if this world has a fixed timeboolean
isGameRule(@NotNull String rule)
Checks if string is a valid game ruleboolean
Gets whether the world is hardcore or not.boolean
Gets if this world is natural.boolean
Gets if this world allow to piglins to survive without shaking and transforming to zombified piglins.boolean
Gets if this world allows players to charge and use respawn anchors.boolean
Returns whether there is thunder.boolean
Deprecated.useisUltraWarm()
boolean
Gets if various water/lava mechanics will be triggered in this world, eg:
Water is evaporated Sponges dry Lava spreads faster and furtherboolean
lineOfSightExists(@NotNull Location from, @NotNull Location to)
Tell whether a line of sight exists between the given locationsvoid
loadChunk(int x, int z)
Loads theChunk
at the specified coordinates.boolean
loadChunk(int x, int z, boolean generate)
Loads theChunk
at the specified coordinates.void
Loads the specifiedChunk
.locateNearestBiome(@NotNull Location origin, @NotNull Biome biome, int radius)
Locates the nearest biome based on an origin, biome type, and radius to search.locateNearestBiome(@NotNull Location origin, @NotNull Biome biome, int radius, int step)
Locates the nearest biome based on an origin, biome type, and radius to search and steplocateNearestRaid(@NotNull Location location, int radius)
Finds the nearest raid close to the given location.locateNearestStructure(@NotNull Location origin, @NotNull StructureType structureType, int radius, boolean findUnexplored)
Find the closest nearby structure of a givenStructureType
.void
playEffect(@NotNull Location location, @NotNull Effect effect, int data)
Plays an effect to all players within a default radius around a given location.void
playEffect(@NotNull Location location, @NotNull Effect effect, int data, int radius)
Plays an effect to all players within a given radius around a location.<T> void
playEffect(@NotNull Location location, @NotNull Effect effect, T data)
Plays an effect to all players within a default radius around a given location.<T> void
playEffect(@NotNull Location location, @NotNull Effect effect, T data, int radius)
Plays an effect to all players within a given radius around a location.void
Play a Sound at the provided Location in the World.void
playSound(@NotNull Location location, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch)
Play a Sound at the provided Location in the World.void
Play a Sound at the provided Location in the Worldvoid
playSound(@NotNull Location location, @NotNull Sound sound, @NotNull SoundCategory category, float volume, float pitch)
Play a Sound at the provided Location in the World.rayTrace(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, @Nullable Predicate<Entity> filter)
Performs a ray trace that checks for both block and entity collisions.rayTraceBlocks(@NotNull Location start, @NotNull Vector direction, double maxDistance)
Performs a ray trace that checks for block collisions using the blocks' precise collision shapes.rayTraceBlocks(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode)
Performs a ray trace that checks for block collisions using the blocks' precise collision shapes.rayTraceBlocks(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks)
Performs a ray trace that checks for block collisions using the blocks' precise collision shapes.rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance)
Performs a ray trace that checks for entity collisions.rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance, double raySize)
Performs a ray trace that checks for entity collisions.rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance, double raySize, @Nullable Predicate<Entity> filter)
Performs a ray trace that checks for entity collisions.rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance, @Nullable Predicate<Entity> filter)
Performs a ray trace that checks for entity collisions.boolean
refreshChunk(int x, int z)
Deprecated.This method is not guaranteed to work suitably across all client implementations.boolean
regenerateChunk(int x, int z)
Deprecated.regenerating a single chunk is not likely to produce the same chunk as before as terrain decoration may be spread across chunks.boolean
removePluginChunkTicket(int x, int z, @NotNull Plugin plugin)
Removes the specified plugin's ticket for the specified chunkvoid
removePluginChunkTickets(@NotNull Plugin plugin)
Removes all plugin tickets for the specified pluginvoid
save()
Saves world to diskvoid
sendGameEvent(@Nullable Entity sourceEntity, @NotNull GameEvent gameEvent, @NotNull Vector position)
Posts a specified game event at a locationvoid
setAmbientSpawnLimit(int limit)
Sets the limit for number of ambient mobs that can spawn in a chunk in this worldvoid
setAnimalSpawnLimit(int limit)
Sets the limit for number of animals that can spawn in a chunk in this worldvoid
setAutoSave(boolean value)
Sets whether or not the world will automatically savevoid
Deprecated.biomes are now 3-dimensionalvoid
setChunkForceLoaded(int x, int z, boolean forced)
Sets whether the chunk at the specified chunk coordinates is force loaded.void
setClearWeatherDuration(int duration)
Set the clear weather duration.void
setDifficulty(@NotNull Difficulty difficulty)
Sets the Difficulty of the world.void
setFullTime(long time)
Sets the in-game time on the server<T> boolean
setGameRule(@NotNull GameRule<T> rule, T newValue)
Set the givenGameRule
's new value.boolean
setGameRuleValue(@NotNull String rule, @NotNull String value)
Deprecated.usesetGameRule(GameRule, Object)
instead.void
setHardcore(boolean hardcore)
Sets whether the world is hardcore or not.void
setKeepSpawnInMemory(boolean keepLoaded)
Sets whether the world's spawn area should be kept loaded into memory or not.void
setMonsterSpawnLimit(int limit)
Sets the limit for number of monsters that can spawn in a chunk in this worldvoid
setNoTickViewDistance(int viewDistance)
Sets the no-tick view distance for this world.void
setPVP(boolean pvp)
Sets the PVP setting for this world.void
setSendViewDistance(int viewDistance)
Sets the sending view distance for this world.void
setSpawnFlags(boolean allowMonsters, boolean allowAnimals)
Sets the spawn flags for this.boolean
setSpawnLocation(int x, int y, int z)
Sets the spawn location of the worldboolean
setSpawnLocation(int x, int y, int z, float angle)
Sets the spawn location of the worldboolean
setSpawnLocation(@NotNull Location location)
Sets the spawn location of the world.void
setStorm(boolean hasStorm)
Set whether there is a storm.void
setThunderDuration(int duration)
Set the thundering duration.void
setThundering(boolean thundering)
Set whether it is thundering.void
setTicksPerAmbientSpawns(int ticksPerAmbientSpawns)
Sets the world's ticks per ambient mob spawns valuevoid
setTicksPerAnimalSpawns(int ticksPerAnimalSpawns)
Sets the world's ticks per animal spawns valuevoid
setTicksPerMonsterSpawns(int ticksPerMonsterSpawns)
Sets the world's ticks per monster spawns valuevoid
setTicksPerWaterAmbientSpawns(int ticksPerAmbientSpawns)
Sets the world's ticks per water ambient mob spawns valuevoid
setTicksPerWaterSpawns(int ticksPerWaterSpawns)
Sets the world's ticks per water mob spawns valuevoid
setTicksPerWaterUndergroundCreatureSpawns(int ticksPerWaterUndergroundCreatureSpawns)
Sets the world's ticks per water underground creature spawns valuevoid
setTime(long time)
Sets the relative in-game time on the server.void
setViewDistance(int viewDistance)
Sets the view distance for this world.void
setWaterAmbientSpawnLimit(int limit)
Sets the limit for number of water ambient mobs that can spawn in a chunk in this worldvoid
setWaterAnimalSpawnLimit(int limit)
Sets the limit for number of water animals that can spawn in a chunk in this worldvoid
setWaterUndergroundCreatureSpawnLimit(int limit)
Sets the limit for number of water underground creature that can spawn in a chunk in this worldvoid
setWeatherDuration(int duration)
Set the remaining time in ticks of the current conditions.spawnArrow(@NotNull Location location, @NotNull Vector direction, float speed, float spread)
<T extends AbstractArrow>
TspawnArrow(@NotNull Location location, @NotNull Vector direction, float speed, float spread, @NotNull Class<T> clazz)
Creates an arrow entity of the given class at the givenLocation
spawnFallingBlock(@NotNull Location location, @NotNull BlockData data)
spawnFallingBlock(@NotNull Location location, @NotNull MaterialData data)
spawnFallingBlock(@NotNull Location location, @NotNull Material material, byte data)
Deprecated.Magic valuevoid
spawnParticle(@NotNull Particle particle, double x, double y, double z, int count)
Spawns the particle (the number of times specified by count) at the target location.void
spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ)
Spawns the particle (the number of times specified by count) at the target location.void
spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra)
Spawns the particle (the number of times specified by count) at the target location.default <T> void
spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data)
Spawns the particle (the number of times specified by count) at the target location.<T> void
spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force)
Spawns the particle (the number of times specified by count) at the target location.<T> void
spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, T data)
Spawns the particle (the number of times specified by count) at the target location.<T> void
spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, T data)
Spawns the particle (the number of times specified by count) at the target location.void
spawnParticle(@NotNull Particle particle, @NotNull Location location, int count)
Spawns the particle (the number of times specified by count) at the target location.void
spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ)
Spawns the particle (the number of times specified by count) at the target location.void
spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra)
Spawns the particle (the number of times specified by count) at the target location.<T> void
spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, T data)
Spawns the particle (the number of times specified by count) at the target location.<T> void
spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force)
Spawns the particle (the number of times specified by count) at the target location.<T> void
spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, T data)
Spawns the particle (the number of times specified by count) at the target location.<T> void
spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, T data)
Spawns the particle (the number of times specified by count) at the target location.default <T> void
spawnParticle(@NotNull Particle particle, @Nullable List<Player> receivers, @NotNull Player source, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data)
Spawns the particle (the number of times specified by count) at the target location.<T> void
spawnParticle(@NotNull Particle particle, @Nullable List<Player> receivers, @Nullable Player source, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force)
Spawns the particle (the number of times specified by count) at the target location.spigot()
strikeLightning(@NotNull Location loc)
Strikes lightning at the givenLocation
Strikes lightning at the givenLocation
without doing damageboolean
unloadChunk(int x, int z)
Safely unloads and saves theChunk
at the specified coordinatesboolean
unloadChunk(int x, int z, boolean save)
Safely unloads and optionally saves theChunk
at the specified coordinates.boolean
unloadChunk(@NotNull Chunk chunk)
Safely unloads and saves theChunk
at the specified coordinatesboolean
unloadChunkRequest(int x, int z)
Safely queues theChunk
at the specified coordinates for unloading.Methods inherited from interface net.kyori.adventure.audience.Audience
openBook, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, showTitle, stopSound
Methods inherited from interface net.kyori.adventure.audience.ForwardingAudience
clearTitle, filterAudience, forEachAudience, hideBossBar, openBook, playSound, playSound, playSound, pointers, resetTitle, sendActionBar, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendTitlePart, showBossBar, stopSound
Methods inherited from interface org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
Methods inherited from interface org.bukkit.plugin.messaging.PluginMessageRecipient
getListeningPluginChannels, sendPluginMessage
Methods inherited from interface net.kyori.adventure.pointer.Pointered
get, getOrDefault, getOrDefaultFrom
Methods inherited from interface org.bukkit.RegionAccessor
generateTree, generateTree, getBiome, getBiome, getBlockData, getBlockData, getBlockState, getBlockState, getType, getType, setBiome, setBiome, setBlockData, setBlockData, setType, setType, spawn, spawn, spawn, spawn, spawn, spawn, spawnEntity, spawnEntity, spawnEntity, spawnEntity
Methods inherited from interface org.bukkit.generator.WorldInfo
getEnvironment, getMaxHeight, getMinHeight, getName, getSeed, getUID
-
Method Details
-
getEntityCount
int getEntityCount()- Returns:
- The amount of Entities in this world
-
getTileEntityCount
int getTileEntityCount()- Returns:
- The amount of Tile Entities in this world
-
getTickableTileEntityCount
int getTickableTileEntityCount()- Returns:
- The amount of Tickable Tile Entities in this world
-
getChunkCount
int getChunkCount()- Returns:
- The amount of Chunks in this world
-
getPlayerCount
int getPlayerCount()- Returns:
- The amount of Players in this world
-
getMoonPhase
- Returns:
- the current moon phase at the current time in the world
-
lineOfSightExists
Tell whether a line of sight exists between the given locations- Parameters:
from
- Location to start atto
- target Location- Returns:
- whether a line of sight exists between
from
andto
-
getBlockAt
Gets theBlock
at the given coordinates- Parameters:
x
- X-coordinate of the blocky
- Y-coordinate of the blockz
- Z-coordinate of the block- Returns:
- Block at the given coordinates
-
getBlockAt
- Parameters:
location
- Location of the block- Returns:
- Block at the given location
-
getBlockAtKey
Gets theBlock
at the given block key- Parameters:
key
- The block key. SeeBlock.getBlockKey()
- Returns:
- Block at the key
- See Also:
Block.getBlockKey(int, int, int)
-
getLocationAtKey
Gets theLocation
at the given block key- Parameters:
key
- The block key. SeeLocation.toBlockKey()
- Returns:
- Location at the key
- See Also:
Block.getBlockKey(int, int, int)
-
getHighestBlockYAt
int getHighestBlockYAt(int x, int z)Gets the highest non-empty (impassable) coordinate at the given coordinates.- Parameters:
x
- X-coordinate of the blocksz
- Z-coordinate of the blocks- Returns:
- Y-coordinate of the highest non-empty block
-
getHighestBlockYAt
Gets the highest non-empty (impassable) coordinate at the givenLocation
.- Parameters:
location
- Location of the blocks- Returns:
- Y-coordinate of the highest non-empty block
-
getHighestBlockAt
Gets the highest non-empty (impassable) block at the given coordinates.- Parameters:
x
- X-coordinate of the blockz
- Z-coordinate of the block- Returns:
- Highest non-empty block
-
getHighestBlockAt
Gets the highest non-empty (impassable) block at the given coordinates.- Parameters:
location
- Coordinates to get the highest block- Returns:
- Highest non-empty block
-
getHighestBlockYAt
@Deprecated int getHighestBlockYAt(int x, int z, @NotNull HeightmapType heightmap) throws UnsupportedOperationExceptionDeprecated.Upstream has added support for this, usegetHighestBlockYAt(int, int, HeightMap)
Returns the highest block's y-coordinate at the specified block coordinates that match the specified heightmap's conditions.implNote: Implementations are recommended to use an iterative search as a fallback before resorting to throwing an
UnsupportedOperationException
.- Parameters:
x
- The block's x-coordinate.z
- The block's z-coordinate.heightmap
- The specified heightmap to use. SeeHeightmapType
- Returns:
- The highest block's y-coordinate at (x, z) that matches the specified heightmap's conditions.
- Throws:
UnsupportedOperationException
- If the heightmap type is not supported.- See Also:
HeightmapType
-
getHighestBlockYAt
@Deprecated default int getHighestBlockYAt(@NotNull @NotNull Location location, @NotNull HeightmapType heightmap) throws UnsupportedOperationExceptionDeprecated.Upstream has added support for this, usegetHighestBlockYAt(Location, HeightMap)
Returns the highest block's y-coordinate at the specified block coordinates that match the specified heightmap's conditions. Note that the y-coordinate of the specified location is ignored.implNote: Implementations are recommended to use an iterative search as a fallback before resorting to throwing an
UnsupportedOperationException
.- Parameters:
location
- The specified block coordinates.heightmap
- The specified heightmap to use. SeeHeightmapType
- Returns:
- The highest block's y-coordinate at
location
that matches the specified heightmap's conditions. - Throws:
UnsupportedOperationException
- If the heightmap type is not supported.- See Also:
HeightmapType
-
getHighestBlockAt
@Deprecated @NotNull default @NotNull Block getHighestBlockAt(int x, int z, @NotNull HeightmapType heightmap) throws UnsupportedOperationExceptionDeprecated.Upstream has added support for this, usegetHighestBlockAt(int, int, HeightMap)
Returns the highestBlock
at the specified block coordinates that match the specified heightmap's conditions.implNote: Implementations are recommended to use an iterative search as a fallback before resorting to throwing an
UnsupportedOperationException
.- Parameters:
x
- The block's x-coordinate.z
- The block's z-coordinate.heightmap
- The specified heightmap to use. SeeHeightmapType
- Returns:
- The highest
Block
at (x, z) that matches the specified heightmap's conditions. - Throws:
UnsupportedOperationException
- If the heightmap type is not supported.- See Also:
HeightmapType
-
getHighestBlockAt
@Deprecated @NotNull default @NotNull Block getHighestBlockAt(@NotNull @NotNull Location location, @NotNull HeightmapType heightmap) throws UnsupportedOperationExceptionDeprecated.Upstream has added support for this, usegetHighestBlockAt(Location, HeightMap)
Returns the highestBlock
at the specified block coordinates that match the specified heightmap's conditions. Note that the y-coordinate of the specified location is ignored.implNote: Implementations are recommended to use an iterative search as a fallback before resorting to throwing an
UnsupportedOperationException
.- Parameters:
location
- The specified block coordinates.heightmap
- The specified heightmap to use. SeeHeightmapType
- Returns:
- The highest
Block
atlocation
that matches the specified heightmap's conditions. - Throws:
UnsupportedOperationException
- If the heightmap type is not supported.- See Also:
HeightmapType
-
getHighestBlockYAt
Gets the highest coordinate corresponding to theHeightMap
at the given coordinates.- Parameters:
x
- X-coordinate of the blocksz
- Z-coordinate of the blocksheightMap
- the heightMap that is used to determine the highest point- Returns:
- Y-coordinate of the highest block corresponding to the
HeightMap
-
getHighestBlockYAt
- Parameters:
location
- Location of the blocksheightMap
- the heightMap that is used to determine the highest point- Returns:
- Y-coordinate of the highest block corresponding to the
HeightMap
-
getHighestBlockAt
Gets the highest block corresponding to theHeightMap
at the given coordinates.- Parameters:
x
- X-coordinate of the blockz
- Z-coordinate of the blockheightMap
- the heightMap that is used to determine the highest point- Returns:
- Highest block corresponding to the
HeightMap
-
getHighestBlockAt
@NotNull @NotNull Block getHighestBlockAt(@NotNull @NotNull Location location, @NotNull @NotNull HeightMap heightMap)Gets the highest block corresponding to theHeightMap
at the given coordinates.- Parameters:
location
- Coordinates to get the highest blockheightMap
- the heightMap that is used to determine the highest point- Returns:
- Highest block corresponding to the
HeightMap
-
getChunkAt
Gets theChunk
at the given coordinates- Parameters:
x
- X-coordinate of the chunkz
- Z-coordinate of the chunk- Returns:
- Chunk at the given coordinates
-
getChunkAt
- Parameters:
location
- Location of the chunk- Returns:
- Chunk at the given location
-
getChunkAt
- Parameters:
block
- Block to get the containing chunk from- Returns:
- The chunk that contains the given block
-
getChunkAt
Gets the chunk at the specified chunk key, which is the X and Z packed into a long. SeeChunk.getChunkKey()
for easy access to the key, or you may calculate it as: long chunkKey = (long) chunkX & 0xffffffffL | ((long) chunkZ & 0xffffffffL) >> 32;- Parameters:
chunkKey
- The Chunk Key to look up the chunk by- Returns:
- The chunk at the specified key
-
isChunkGenerated
default boolean isChunkGenerated(long chunkKey)Checks if aChunk
has been generated at the specified chunk key, which is the X and Z packed into a long.- Parameters:
chunkKey
- The Chunk Key to look up the chunk by- Returns:
- true if the chunk has been generated, otherwise false
-
isChunkLoaded
Checks if the specifiedChunk
is loaded- Parameters:
chunk
- The chunk to check- Returns:
- true if the chunk is loaded, otherwise false
-
getLoadedChunks
Gets an array of all loadedChunk
s- Returns:
- Chunk[] containing all loaded chunks
-
loadChunk
Loads the specifiedChunk
.This method will keep the specified chunk loaded until one of the unload methods is manually called. Callers are advised to instead use getChunkAt which will only temporarily load the requested chunk.
- Parameters:
chunk
- The chunk to load
-
isChunkLoaded
boolean isChunkLoaded(int x, int z)Checks if theChunk
at the specified coordinates is loaded- Parameters:
x
- X-coordinate of the chunkz
- Z-coordinate of the chunk- Returns:
- true if the chunk is loaded, otherwise false
-
isChunkGenerated
boolean isChunkGenerated(int x, int z)Checks if theChunk
at the specified coordinates is generated- Parameters:
x
- X-coordinate of the chunkz
- Z-coordinate of the chunk- Returns:
- true if the chunk is generated, otherwise false
-
isChunkInUse
Deprecated.This method was added to facilitate chunk garbage collection. As of the current Minecraft version chunks are now strictly managed and will not be loaded for more than 1 tick unless they are in use.Checks if theChunk
at the specified coordinates is loaded and in use by one or more players- Parameters:
x
- X-coordinate of the chunkz
- Z-coordinate of the chunk- Returns:
- true if the chunk is loaded and in use by one or more players, otherwise false
-
loadChunk
void loadChunk(int x, int z)Loads theChunk
at the specified coordinates.This method will keep the specified chunk loaded until one of the unload methods is manually called. Callers are advised to instead use getChunkAt which will only temporarily load the requested chunk.
If the chunk does not exist, it will be generated.
This method is analogous to
loadChunk(int, int, boolean)
where generate is true.- Parameters:
x
- X-coordinate of the chunkz
- Z-coordinate of the chunk
-
loadChunk
boolean loadChunk(int x, int z, boolean generate)Loads theChunk
at the specified coordinates.This method will keep the specified chunk loaded until one of the unload methods is manually called. Callers are advised to instead use getChunkAt which will only temporarily load the requested chunk.
- Parameters:
x
- X-coordinate of the chunkz
- Z-coordinate of the chunkgenerate
- Whether or not to generate a chunk if it doesn't already exist- Returns:
- true if the chunk has loaded successfully, otherwise false
-
unloadChunk
Safely unloads and saves theChunk
at the specified coordinatesThis method is analogous to
unloadChunk(int, int, boolean)
where save is true.- Parameters:
chunk
- the chunk to unload- Returns:
- true if the chunk has unloaded successfully, otherwise false
-
unloadChunk
boolean unloadChunk(int x, int z)Safely unloads and saves theChunk
at the specified coordinatesThis method is analogous to
unloadChunk(int, int, boolean)
where save is true.- Parameters:
x
- X-coordinate of the chunkz
- Z-coordinate of the chunk- Returns:
- true if the chunk has unloaded successfully, otherwise false
-
unloadChunk
boolean unloadChunk(int x, int z, boolean save)Safely unloads and optionally saves theChunk
at the specified coordinates.- Parameters:
x
- X-coordinate of the chunkz
- Z-coordinate of the chunksave
- Whether or not to save the chunk- Returns:
- true if the chunk has unloaded successfully, otherwise false
-
unloadChunkRequest
boolean unloadChunkRequest(int x, int z)Safely queues theChunk
at the specified coordinates for unloading.- Parameters:
x
- X-coordinate of the chunkz
- Z-coordinate of the chunk- Returns:
- true is the queue attempt was successful, otherwise false
-
regenerateChunk
Deprecated.regenerating a single chunk is not likely to produce the same chunk as before as terrain decoration may be spread across chunks. Use of this method should be avoided as it is known to produce buggy results.Regenerates theChunk
at the specified coordinates- Parameters:
x
- X-coordinate of the chunkz
- Z-coordinate of the chunk- Returns:
- Whether the chunk was actually regenerated
-
refreshChunk
Deprecated.This method is not guaranteed to work suitably across all client implementations.Resends theChunk
to all clients- Parameters:
x
- X-coordinate of the chunkz
- Z-coordinate of the chunk- Returns:
- Whether the chunk was actually refreshed
-
isChunkForceLoaded
boolean isChunkForceLoaded(int x, int z)Gets whether the chunk at the specified chunk coordinates is force loaded.A force loaded chunk will not be unloaded due to lack of player activity.
- Parameters:
x
- X-coordinate of the chunkz
- Z-coordinate of the chunk- Returns:
- force load status
-
setChunkForceLoaded
void setChunkForceLoaded(int x, int z, boolean forced)Sets whether the chunk at the specified chunk coordinates is force loaded.A force loaded chunk will not be unloaded due to lack of player activity.
- Parameters:
x
- X-coordinate of the chunkz
- Z-coordinate of the chunkforced
- force load status
-
getForceLoadedChunks
Returns all force loaded chunks in this world.A force loaded chunk will not be unloaded due to lack of player activity.
- Returns:
- unmodifiable collection of force loaded chunks
-
addPluginChunkTicket
Adds a plugin ticket for the specified chunk, loading the chunk if it is not already loaded.A plugin ticket will prevent a chunk from unloading until it is explicitly removed. A plugin instance may only have one ticket per chunk, but each chunk can have multiple plugin tickets.
- Parameters:
x
- X-coordinate of the chunkz
- Z-coordinate of the chunkplugin
- Plugin which owns the ticket- Returns:
true
if a plugin ticket was added,false
if the ticket already exists for the plugin- Throws:
IllegalStateException
- If the specified plugin is not enabled- See Also:
removePluginChunkTicket(int, int, Plugin)
-
removePluginChunkTicket
Removes the specified plugin's ticket for the specified chunkA plugin ticket will prevent a chunk from unloading until it is explicitly removed. A plugin instance may only have one ticket per chunk, but each chunk can have multiple plugin tickets.
- Parameters:
x
- X-coordinate of the chunkz
- Z-coordinate of the chunkplugin
- Plugin which owns the ticket- Returns:
true
if the plugin ticket was removed,false
if there is no plugin ticket for the chunk- See Also:
addPluginChunkTicket(int, int, Plugin)
-
removePluginChunkTickets
Removes all plugin tickets for the specified pluginA plugin ticket will prevent a chunk from unloading until it is explicitly removed. A plugin instance may only have one ticket per chunk, but each chunk can have multiple plugin tickets.
- Parameters:
plugin
- Specified plugin- See Also:
addPluginChunkTicket(int, int, Plugin)
,removePluginChunkTicket(int, int, Plugin)
-
getPluginChunkTickets
Retrieves a collection specifying which plugins have tickets for the specified chunk. This collection is not updated when plugin tickets are added or removed to the chunk.A plugin ticket will prevent a chunk from unloading until it is explicitly removed. A plugin instance may only have one ticket per chunk, but each chunk can have multiple plugin tickets.
- Parameters:
x
- X-coordinate of the chunkz
- Z-coordinate of the chunk- Returns:
- unmodifiable collection containing which plugins have tickets for the chunk
- See Also:
addPluginChunkTicket(int, int, Plugin)
,removePluginChunkTicket(int, int, Plugin)
-
getPluginChunkTickets
Returns a map of which plugins have tickets for what chunks. The returned map is not updated when plugin tickets are added or removed to chunks. If a plugin has no tickets, it will be absent from the map.A plugin ticket will prevent a chunk from unloading until it is explicitly removed. A plugin instance may only have one ticket per chunk, but each chunk can have multiple plugin tickets.
- Returns:
- unmodifiable map containing which plugins have tickets for what chunks
- See Also:
addPluginChunkTicket(int, int, Plugin)
,removePluginChunkTicket(int, int, Plugin)
-
dropItem
@NotNull @NotNull Item dropItem(@NotNull @NotNull Location location, @NotNull @NotNull ItemStack item)Drops an item at the specifiedLocation
- Parameters:
location
- Location to drop the itemitem
- ItemStack to drop- Returns:
- ItemDrop entity created as a result of this method
-
dropItem
@NotNull @NotNull Item dropItem(@NotNull @NotNull Location location, @NotNull @NotNull ItemStack item, @Nullable @Nullable Consumer<Item> function)Drops an item at the specifiedLocation
Note that functions will run before the entity is spawned- Parameters:
location
- Location to drop the itemitem
- ItemStack to dropfunction
- the function to be run before the entity is spawned.- Returns:
- ItemDrop entity created as a result of this method
-
dropItemNaturally
@NotNull @NotNull Item dropItemNaturally(@NotNull @NotNull Location location, @NotNull @NotNull ItemStack item)Drops an item at the specifiedLocation
with a random offset- Parameters:
location
- Location to drop the itemitem
- ItemStack to drop- Returns:
- ItemDrop entity created as a result of this method
-
dropItemNaturally
@NotNull @NotNull Item dropItemNaturally(@NotNull @NotNull Location location, @NotNull @NotNull ItemStack item, @Nullable @Nullable Consumer<Item> function)Drops an item at the specifiedLocation
with a random offset Note that functions will run before the entity is spawned- Parameters:
location
- Location to drop the itemitem
- ItemStack to dropfunction
- the function to be run before the entity is spawned.- Returns:
- ItemDrop entity created as a result of this method
-
spawnArrow
@NotNull @NotNull Arrow spawnArrow(@NotNull @NotNull Location location, @NotNull @NotNull Vector direction, float speed, float spread)- Parameters:
location
- Location to spawn the arrowdirection
- Direction to shoot the arrow inspeed
- Speed of the arrow. A recommend speed is 0.6spread
- Spread of the arrow. A recommend spread is 12- Returns:
- Arrow entity spawned as a result of this method
-
spawnArrow
@NotNull <T extends AbstractArrow> T spawnArrow(@NotNull @NotNull Location location, @NotNull @NotNull Vector direction, float speed, float spread, @NotNull @NotNull Class<T> clazz)Creates an arrow entity of the given class at the givenLocation
- Type Parameters:
T
- type of arrow to spawn- Parameters:
location
- Location to spawn the arrowdirection
- Direction to shoot the arrow inspeed
- Speed of the arrow. A recommend speed is 0.6spread
- Spread of the arrow. A recommend spread is 12clazz
- the Entity class for the arrowSpectralArrow
,Arrow
,TippedArrow
- Returns:
- Arrow entity spawned as a result of this method
-
generateTree
Creates a tree at the givenLocation
- Parameters:
location
- Location to spawn the treetype
- Type of the tree to create- Returns:
- true if the tree was created successfully, otherwise false
-
generateTree
@Deprecated boolean generateTree(@NotNull @NotNull Location loc, @NotNull @NotNull TreeType type, @NotNull @NotNull BlockChangeDelegate delegate)Deprecated.this method does not handle tile entities (bee nests)Creates a tree at the givenLocation
- Parameters:
loc
- Location to spawn the treetype
- Type of the tree to createdelegate
- A class to call for each block changed as a result of this method- Returns:
- true if the tree was created successfully, otherwise false
- See Also:
RegionAccessor.generateTree(org.bukkit.Location, java.util.Random, org.bukkit.TreeType, org.bukkit.util.Consumer)
-
strikeLightning
Strikes lightning at the givenLocation
- Parameters:
loc
- The location to strike lightning- Returns:
- The lightning entity.
-
strikeLightningEffect
Strikes lightning at the givenLocation
without doing damage- Parameters:
loc
- The location to strike lightning- Returns:
- The lightning entity.
-
findLightningRod
Finds the location of the nearest unobstructed Lightning Rod in a 128-block radius around the given location. Returnsnull
if no Lightning Rod is found.Note: To activate a Lightning Rod, the position one block above it must be struck by lightning.
-
findLightningTarget
Finds a targetLocation
for lightning to strike.It selects from (in the following order):
- the block above the nearest Lightning Rod, found using
findLightningRod(Location)
- a random
LivingEntity
that can see the sky in a 6x6 cuboid around input X/Z coordinates. Y ranges from the highest motion-blocking block at the input X/Z - 3 to the height limit + 3
Returns
null
if no target is found.- Parameters:
location
-Location
to search for target around- Returns:
- lightning target or
null
- the block above the nearest Lightning Rod, found using
-
getEntities
Get a list of all entities in this World- Specified by:
getEntities
in interfaceRegionAccessor
- Returns:
- A List of all Entities currently residing in this world
-
getLivingEntities
Get a list of all living entities in this World- Specified by:
getLivingEntities
in interfaceRegionAccessor
- Returns:
- A List of all LivingEntities currently residing in this world
-
getEntitiesByClass
@Deprecated @NotNull <T extends Entity> @NotNull Collection<T> getEntitiesByClass(@NotNull @NotNull Class<T>... classes)Deprecated.Get a collection of all entities in this World matching the given class/interface- Type Parameters:
T
- an entity subclass- Parameters:
classes
- The classes representing the types of entity to match- Returns:
- A List of all Entities currently residing in this world that match the given class/interface
-
getEntitiesByClass
@NotNull <T extends Entity> @NotNull Collection<T> getEntitiesByClass(@NotNull @NotNull Class<T> cls)Get a collection of all entities in this World matching the given class/interface- Specified by:
getEntitiesByClass
in interfaceRegionAccessor
- Type Parameters:
T
- an entity subclass- Parameters:
cls
- The class representing the type of entity to match- Returns:
- A List of all Entities currently residing in this world that match the given class/interface
-
getEntitiesByClasses
Get a collection of all entities in this World matching any of the given classes/interfaces- Specified by:
getEntitiesByClasses
in interfaceRegionAccessor
- Parameters:
classes
- The classes representing the types of entity to match- Returns:
- A List of all Entities currently residing in this world that match one or more of the given classes/interfaces
-
getNearbyLivingEntities
@NotNull default @NotNull Collection<LivingEntity> getNearbyLivingEntities(@NotNull @NotNull Location loc, double radius)Gets nearby players within the specified radius (bounding box)- Parameters:
loc
- Center locationradius
- Radius- Returns:
- the collection of entities near location. This will always be a non-null collection.
-
getNearbyLivingEntities
@NotNull default @NotNull Collection<LivingEntity> getNearbyLivingEntities(@NotNull @NotNull Location loc, double xzRadius, double yRadius)Gets nearby players within the specified radius (bounding box)- Parameters:
loc
- Center locationxzRadius
- X/Z RadiusyRadius
- Y Radius- Returns:
- the collection of entities near location. This will always be a non-null collection.
-
getNearbyLivingEntities
@NotNull default @NotNull Collection<LivingEntity> getNearbyLivingEntities(@NotNull @NotNull Location loc, double xRadius, double yRadius, double zRadius)Gets nearby players within the specified radius (bounding box)- Parameters:
loc
- Center locationxRadius
- X RadiusyRadius
- Y RadiuszRadius
- Z radius- Returns:
- the collection of entities near location. This will always be a non-null collection.
-
getNearbyLivingEntities
@NotNull default @NotNull Collection<LivingEntity> getNearbyLivingEntities(@NotNull @NotNull Location loc, double radius, @Nullable @Nullable Predicate<LivingEntity> predicate)Gets nearby players within the specified radius (bounding box)- Parameters:
loc
- Center locationradius
- X Radiuspredicate
- a predicate used to filter results- Returns:
- the collection of living entities near location. This will always be a non-null collection
-
getNearbyLivingEntities
@NotNull default @NotNull Collection<LivingEntity> getNearbyLivingEntities(@NotNull @NotNull Location loc, double xzRadius, double yRadius, @Nullable @Nullable Predicate<LivingEntity> predicate)Gets nearby players within the specified radius (bounding box)- Parameters:
loc
- Center locationxzRadius
- X/Z RadiusyRadius
- Y Radiuspredicate
- a predicate used to filter results- Returns:
- the collection of living entities near location. This will always be a non-null collection
-
getNearbyLivingEntities
@NotNull default @NotNull Collection<LivingEntity> getNearbyLivingEntities(@NotNull @NotNull Location loc, double xRadius, double yRadius, double zRadius, @Nullable @Nullable Predicate<LivingEntity> predicate)Gets nearby players within the specified radius (bounding box)- Parameters:
loc
- Center locationxRadius
- X RadiusyRadius
- Y RadiuszRadius
- Z radiuspredicate
- a predicate used to filter results- Returns:
- the collection of living entities near location. This will always be a non-null collection.
-
getNearbyPlayers
@NotNull default @NotNull Collection<Player> getNearbyPlayers(@NotNull @NotNull Location loc, double radius)Gets nearby players within the specified radius (bounding box)- Parameters:
loc
- Center locationradius
- X/Y/Z Radius- Returns:
- the collection of living entities near location. This will always be a non-null collection.
-
getNearbyPlayers
@NotNull default @NotNull Collection<Player> getNearbyPlayers(@NotNull @NotNull Location loc, double xzRadius, double yRadius)Gets nearby players within the specified radius (bounding box)- Parameters:
loc
- Center locationxzRadius
- X/Z RadiusyRadius
- Y Radius- Returns:
- the collection of living entities near location. This will always be a non-null collection.
-
getNearbyPlayers
@NotNull default @NotNull Collection<Player> getNearbyPlayers(@NotNull @NotNull Location loc, double xRadius, double yRadius, double zRadius)Gets nearby players within the specified radius (bounding box)- Parameters:
loc
- Center locationxRadius
- X RadiusyRadius
- Y RadiuszRadius
- Z Radius- Returns:
- the collection of players near location. This will always be a non-null collection.
-
getNearbyPlayers
@NotNull default @NotNull Collection<Player> getNearbyPlayers(@NotNull @NotNull Location loc, double radius, @Nullable @Nullable Predicate<Player> predicate)Gets nearby players within the specified radius (bounding box)- Parameters:
loc
- Center locationradius
- X/Y/Z Radiuspredicate
- a predicate used to filter results- Returns:
- the collection of players near location. This will always be a non-null collection.
-
getNearbyPlayers
@NotNull default @NotNull Collection<Player> getNearbyPlayers(@NotNull @NotNull Location loc, double xzRadius, double yRadius, @Nullable @Nullable Predicate<Player> predicate)Gets nearby players within the specified radius (bounding box)- Parameters:
loc
- Center locationxzRadius
- X/Z RadiusyRadius
- Y Radiuspredicate
- a predicate used to filter results- Returns:
- the collection of players near location. This will always be a non-null collection.
-
getNearbyPlayers
@NotNull default @NotNull Collection<Player> getNearbyPlayers(@NotNull @NotNull Location loc, double xRadius, double yRadius, double zRadius, @Nullable @Nullable Predicate<Player> predicate)Gets nearby players within the specified radius (bounding box)- Parameters:
loc
- Center locationxRadius
- X RadiusyRadius
- Y RadiuszRadius
- Z Radiuspredicate
- a predicate used to filter results- Returns:
- the collection of players near location. This will always be a non-null collection.
-
getNearbyEntitiesByType
@NotNull default <T extends Entity> @NotNull Collection<T> getNearbyEntitiesByType(@Nullable @Nullable Class<? extends T> clazz, @NotNull @NotNull Location loc, double radius)Gets all nearby entities of the specified type, within the specified radius (bounding box)- Type Parameters:
T
- the entity type- Parameters:
clazz
- Type to filter byloc
- Center locationradius
- X/Y/Z radius to search within- Returns:
- the collection of entities near location. This will always be a non-null collection.
-
getNearbyEntitiesByType
@NotNull default <T extends Entity> @NotNull Collection<T> getNearbyEntitiesByType(@Nullable @Nullable Class<? extends T> clazz, @NotNull @NotNull Location loc, double xzRadius, double yRadius)Gets all nearby entities of the specified type, within the specified radius, with x and x radius matching (bounding box)- Type Parameters:
T
- the entity type- Parameters:
clazz
- Type to filter byloc
- Center locationxzRadius
- X/Z radius to search withinyRadius
- Y radius to search within- Returns:
- the collection of entities near location. This will always be a non-null collection.
-
getNearbyEntitiesByType
@NotNull default <T extends Entity> @NotNull Collection<T> getNearbyEntitiesByType(@Nullable @Nullable Class<? extends T> clazz, @NotNull @NotNull Location loc, double xRadius, double yRadius, double zRadius)Gets all nearby entities of the specified type, within the specified radius (bounding box)- Type Parameters:
T
- the entity type- Parameters:
clazz
- Type to filter byloc
- Center locationxRadius
- X RadiusyRadius
- Y RadiuszRadius
- Z Radius- Returns:
- the collection of entities near location. This will always be a non-null collection.
-
getNearbyEntitiesByType
@NotNull default <T extends Entity> @NotNull Collection<T> getNearbyEntitiesByType(@Nullable @Nullable Class<? extends T> clazz, @NotNull @NotNull Location loc, double radius, @Nullable @Nullable Predicate<T> predicate)Gets all nearby entities of the specified type, within the specified radius (bounding box)- Type Parameters:
T
- the entity type- Parameters:
clazz
- Type to filter byloc
- Center locationradius
- X/Y/Z radius to search withinpredicate
- a predicate used to filter results- Returns:
- the collection of entities near location. This will always be a non-null collection.
-
getNearbyEntitiesByType
@NotNull default <T extends Entity> @NotNull Collection<T> getNearbyEntitiesByType(@Nullable @Nullable Class<? extends T> clazz, @NotNull @NotNull Location loc, double xzRadius, double yRadius, @Nullable @Nullable Predicate<T> predicate)Gets all nearby entities of the specified type, within the specified radius, with x and x radius matching (bounding box)- Type Parameters:
T
- the entity type- Parameters:
clazz
- Type to filter byloc
- Center locationxzRadius
- X/Z radius to search withinyRadius
- Y radius to search withinpredicate
- a predicate used to filter results- Returns:
- the collection of entities near location. This will always be a non-null collection.
-
getNearbyEntitiesByType
@NotNull default <T extends Entity> @NotNull Collection<T> getNearbyEntitiesByType(@Nullable @Nullable Class<? extends Entity> clazz, @NotNull @NotNull Location loc, double xRadius, double yRadius, double zRadius, @Nullable @Nullable Predicate<T> predicate)Gets all nearby entities of the specified type, within the specified radius (bounding box)- Type Parameters:
T
- the entity type- Parameters:
clazz
- Type to filter byloc
- Center locationxRadius
- X RadiusyRadius
- Y RadiuszRadius
- Z Radiuspredicate
- a predicate used to filter results- Returns:
- the collection of entities near location. This will always be a non-null collection.
-
getChunkAtAsync
@Deprecated default void getChunkAtAsync(int x, int z, @NotNull @NotNull World.ChunkLoadCallback cb)Deprecated.Use either the Future or the Consumer based methodsRequests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time. You should use this method if you need a chunk but do not need it immediately, and you wish to let the server control the speed of chunk loads, keeping performance in mind. TheWorld.ChunkLoadCallback
will always be executed synchronously on the main Server Thread.- Parameters:
x
- Chunk X-coordinate of the chunk - (world coordinate / 16)z
- Chunk Z-coordinate of the chunk - (world coordinate / 16)cb
- Callback to receive the chunk when it is loaded. will be executed synchronously
-
getChunkAtAsync
@Deprecated default void getChunkAtAsync(@NotNull @NotNull Location loc, @NotNull @NotNull World.ChunkLoadCallback cb)Deprecated.Use either the Future or the Consumer based methodsRequests aChunk
to be loaded at the givenLocation
This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time. You should use this method if you need a chunk but do not need it immediately, and you wish to let the server control the speed of chunk loads, keeping performance in mind. TheWorld.ChunkLoadCallback
will always be executed synchronously on the main Server Thread.- Parameters:
loc
- Location of the chunkcb
- Callback to receive the chunk when it is loaded. will be executed synchronously
-
getChunkAtAsync
@Deprecated default void getChunkAtAsync(@NotNull @NotNull Block block, @NotNull @NotNull World.ChunkLoadCallback cb)Deprecated.Use either the Future or the Consumer based methodsRequestsChunk
to be loaded that contains the givenBlock
This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time. You should use this method if you need a chunk but do not need it immediately, and you wish to let the server control the speed of chunk loads, keeping performance in mind. TheWorld.ChunkLoadCallback
will always be executed synchronously on the main Server Thread.- Parameters:
block
- Block to get the containing chunk fromcb
- Callback to receive the chunk when it is loaded. will be executed synchronously
-
getChunkAtAsync
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time. You should use this method if you need a chunk but do not need it immediately, and you wish to let the server control the speed of chunk loads, keeping performance in mind. TheConsumer
will always be executed synchronously on the main Server Thread.- Parameters:
x
- Chunk X-coordinate of the chunk - (world coordinate / 16)z
- Chunk Z-coordinate of the chunk - (world coordinate / 16)cb
- Callback to receive the chunk when it is loaded. will be executed synchronously
-
getChunkAtAsync
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time. You should use this method if you need a chunk but do not need it immediately, and you wish to let the server control the speed of chunk loads, keeping performance in mind. TheConsumer
will always be executed synchronously on the main Server Thread.- Parameters:
x
- Chunk X-coordinate of the chunk - (world coordinate / 16)z
- Chunk Z-coordinate of the chunk - (world coordinate / 16)gen
- Should we generate a chunk if it doesn't exists or notcb
- Callback to receive the chunk when it is loaded. will be executed synchronously
-
getChunkAtAsync
Requests aChunk
to be loaded at the givenLocation
This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time. You should use this method if you need a chunk but do not need it immediately, and you wish to let the server control the speed of chunk loads, keeping performance in mind. TheConsumer
will always be executed synchronously on the main Server Thread.- Parameters:
loc
- Location of the chunkcb
- Callback to receive the chunk when it is loaded. will be executed synchronously
-
getChunkAtAsync
default void getChunkAtAsync(@NotNull @NotNull Location loc, boolean gen, @NotNull Consumer<Chunk> cb)Requests aChunk
to be loaded at the givenLocation
This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time. You should use this method if you need a chunk but do not need it immediately, and you wish to let the server control the speed of chunk loads, keeping performance in mind. TheConsumer
will always be executed synchronously on the main Server Thread.- Parameters:
loc
- Location of the chunkgen
- Should the chunk generatecb
- Callback to receive the chunk when it is loaded. will be executed synchronously
-
getChunkAtAsync
RequestsChunk
to be loaded that contains the givenBlock
This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time. You should use this method if you need a chunk but do not need it immediately, and you wish to let the server control the speed of chunk loads, keeping performance in mind. TheConsumer
will always be executed synchronously on the main Server Thread.- Parameters:
block
- Block to get the containing chunk fromcb
- Callback to receive the chunk when it is loaded. will be executed synchronously
-
getChunkAtAsync
default void getChunkAtAsync(@NotNull @NotNull Block block, boolean gen, @NotNull Consumer<Chunk> cb)RequestsChunk
to be loaded that contains the givenBlock
This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time. You should use this method if you need a chunk but do not need it immediately, and you wish to let the server control the speed of chunk loads, keeping performance in mind. TheConsumer
will always be executed synchronously on the main Server Thread.- Parameters:
block
- Block to get the containing chunk fromgen
- Should the chunk generatecb
- Callback to receive the chunk when it is loaded. will be executed synchronously
-
getChunkAtAsync
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time. You should use this method if you need a chunk but do not need it immediately, and you wish to let the server control the speed of chunk loads, keeping performance in mind. The future will always be executed synchronously on the main Server Thread.- Parameters:
loc
- Location to load the corresponding chunk from- Returns:
- Future that will resolve when the chunk is loaded
-
getChunkAtAsync
@NotNull default CompletableFuture<Chunk> getChunkAtAsync(@NotNull @NotNull Location loc, boolean gen)Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time. You should use this method if you need a chunk but do not need it immediately, and you wish to let the server control the speed of chunk loads, keeping performance in mind. The future will always be executed synchronously on the main Server Thread.- Parameters:
loc
- Location to load the corresponding chunk fromgen
- Should the chunk generate- Returns:
- Future that will resolve when the chunk is loaded
-
getChunkAtAsync
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time. You should use this method if you need a chunk but do not need it immediately, and you wish to let the server control the speed of chunk loads, keeping performance in mind. The future will always be executed synchronously on the main Server Thread.- Parameters:
block
- Block to load the corresponding chunk from- Returns:
- Future that will resolve when the chunk is loaded
-
getChunkAtAsync
@NotNull default CompletableFuture<Chunk> getChunkAtAsync(@NotNull @NotNull Block block, boolean gen)Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time. You should use this method if you need a chunk but do not need it immediately, and you wish to let the server control the speed of chunk loads, keeping performance in mind. The future will always be executed synchronously on the main Server Thread.- Parameters:
block
- Block to load the corresponding chunk fromgen
- Should the chunk generate- Returns:
- Future that will resolve when the chunk is loaded
-
getChunkAtAsync
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time. You should use this method if you need a chunk but do not need it immediately, and you wish to let the server control the speed of chunk loads, keeping performance in mind. The future will always be executed synchronously on the main Server Thread.- Parameters:
x
- X Coordz
- Z Coord- Returns:
- Future that will resolve when the chunk is loaded
-
getChunkAtAsync
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time. You should use this method if you need a chunk but do not need it immediately, and you wish to let the server control the speed of chunk loads, keeping performance in mind. The future will always be executed synchronously on the main Server Thread.- Parameters:
x
- Chunk X-coordinate of the chunk - (world coordinate / 16)z
- Chunk Z-coordinate of the chunk - (world coordinate / 16)gen
- Should we generate a chunk if it doesn't exists or not- Returns:
- Future that will resolve when the chunk is loaded
-
getChunkAtAsyncUrgently
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time. You should use this method if you need a chunk but do not need it immediately, and you wish to let the server control the speed of chunk loads, keeping performance in mind. The future will always be executed synchronously on the main Server Thread.- Parameters:
loc
- Location to load the corresponding chunk from- Returns:
- Future that will resolve when the chunk is loaded
-
getChunkAtAsyncUrgently
@NotNull default CompletableFuture<Chunk> getChunkAtAsyncUrgently(@NotNull @NotNull Location loc, boolean gen)Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time. You should use this method if you need a chunk but do not need it immediately, and you wish to let the server control the speed of chunk loads, keeping performance in mind. The future will always be executed synchronously on the main Server Thread.- Parameters:
loc
- Location to load the corresponding chunk fromgen
- Should the chunk generate- Returns:
- Future that will resolve when the chunk is loaded
-
getChunkAtAsyncUrgently
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time. You should use this method if you need a chunk but do not need it immediately, and you wish to let the server control the speed of chunk loads, keeping performance in mind. The future will always be executed synchronously on the main Server Thread.- Parameters:
block
- Block to load the corresponding chunk from- Returns:
- Future that will resolve when the chunk is loaded
-
getChunkAtAsyncUrgently
@NotNull default CompletableFuture<Chunk> getChunkAtAsyncUrgently(@NotNull @NotNull Block block, boolean gen)Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time. You should use this method if you need a chunk but do not need it immediately, and you wish to let the server control the speed of chunk loads, keeping performance in mind. The future will always be executed synchronously on the main Server Thread.- Parameters:
block
- Block to load the corresponding chunk fromgen
- Should the chunk generate- Returns:
- Future that will resolve when the chunk is loaded
-
getChunkAtAsyncUrgently
Requests aChunk
to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time. You should use this method if you need a chunk but do not need it immediately, and you wish to let the server control the speed of chunk loads, keeping performance in mind. The future will always be executed synchronously on the main Server Thread.- Parameters:
x
- X Coordz
- Z Coord- Returns:
- Future that will resolve when the chunk is loaded
-
getChunkAtAsync
-
getKey
Get the world's key -
getPlayers
Get a list of all players in this World- Returns:
- A list of all Players currently residing in this world
-
audiences
Description copied from interface:net.kyori.adventure.audience.ForwardingAudience
Gets the audiences.- Specified by:
audiences
in interfaceForwardingAudience
- Returns:
- the audiences
-
getNearbyEntities
@NotNull @NotNull Collection<Entity> getNearbyEntities(@NotNull @NotNull Location location, double x, double y, double z)Returns a list of entities within a bounding box centered around a Location.This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the size of the search bounding box.
- Parameters:
location
- The center of the bounding boxx
- 1/2 the size of the box along x axisy
- 1/2 the size of the box along y axisz
- 1/2 the size of the box along z axis- Returns:
- the collection of entities near location. This will always be a non-null collection.
-
getEntity
Gets an entity in this world by its UUID- Parameters:
uuid
- the UUID of the entity- Returns:
- the entity with the given UUID, or null if it isn't found
-
getNearbyEntities
@NotNull @NotNull Collection<Entity> getNearbyEntities(@NotNull @NotNull Location location, double x, double y, double z, @Nullable @Nullable Predicate<Entity> filter)Returns a list of entities within a bounding box centered around a Location.This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the size of the search bounding box.
- Parameters:
location
- The center of the bounding boxx
- 1/2 the size of the box along x axisy
- 1/2 the size of the box along y axisz
- 1/2 the size of the box along z axisfilter
- only entities that fulfill this predicate are considered, ornull
to consider all entities- Returns:
- the collection of entities near location. This will always be a non-null collection.
-
getNearbyEntities
Returns a list of entities within the given bounding box.This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the size of the search bounding box.
- Parameters:
boundingBox
- the bounding box- Returns:
- the collection of entities within the bounding box, will always be a non-null collection
-
getNearbyEntities
@NotNull @NotNull Collection<Entity> getNearbyEntities(@NotNull @NotNull BoundingBox boundingBox, @Nullable @Nullable Predicate<Entity> filter)Returns a list of entities within the given bounding box.This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the size of the search bounding box.
- Parameters:
boundingBox
- the bounding boxfilter
- only entities that fulfill this predicate are considered, ornull
to consider all entities- Returns:
- the collection of entities within the bounding box, will always be a non-null collection
-
rayTraceEntities
@Nullable @Nullable RayTraceResult rayTraceEntities(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance)Performs a ray trace that checks for entity collisions.This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the maximum distance.
- Parameters:
start
- the start positiondirection
- the ray directionmaxDistance
- the maximum distance- Returns:
- the closest ray trace hit result, or
null
if there is no hit - See Also:
rayTraceEntities(Location, Vector, double, double, Predicate)
-
rayTraceEntities
@Nullable @Nullable RayTraceResult rayTraceEntities(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance, double raySize)Performs a ray trace that checks for entity collisions.This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the maximum distance.
- Parameters:
start
- the start positiondirection
- the ray directionmaxDistance
- the maximum distanceraySize
- entity bounding boxes will be uniformly expanded (or shrinked) by this value before doing collision checks- Returns:
- the closest ray trace hit result, or
null
if there is no hit - See Also:
rayTraceEntities(Location, Vector, double, double, Predicate)
-
rayTraceEntities
@Nullable @Nullable RayTraceResult rayTraceEntities(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance, @Nullable @Nullable Predicate<Entity> filter)Performs a ray trace that checks for entity collisions.This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the maximum distance.
- Parameters:
start
- the start positiondirection
- the ray directionmaxDistance
- the maximum distancefilter
- only entities that fulfill this predicate are considered, ornull
to consider all entities- Returns:
- the closest ray trace hit result, or
null
if there is no hit - See Also:
rayTraceEntities(Location, Vector, double, double, Predicate)
-
rayTraceEntities
@Nullable @Nullable RayTraceResult rayTraceEntities(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance, double raySize, @Nullable @Nullable Predicate<Entity> filter)Performs a ray trace that checks for entity collisions.This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the maximum distance.
- Parameters:
start
- the start positiondirection
- the ray directionmaxDistance
- the maximum distanceraySize
- entity bounding boxes will be uniformly expanded (or shrinked) by this value before doing collision checksfilter
- only entities that fulfill this predicate are considered, ornull
to consider all entities- Returns:
- the closest ray trace hit result, or
null
if there is no hit
-
rayTraceBlocks
@Nullable @Nullable RayTraceResult rayTraceBlocks(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance)Performs a ray trace that checks for block collisions using the blocks' precise collision shapes.This takes collisions with passable blocks into account, but ignores fluids.
This may cause loading of chunks! Some implementations may impose artificial restrictions on the maximum distance.
- Parameters:
start
- the start locationdirection
- the ray directionmaxDistance
- the maximum distance- Returns:
- the ray trace hit result, or
null
if there is no hit - See Also:
rayTraceBlocks(Location, Vector, double, FluidCollisionMode, boolean)
-
rayTraceBlocks
@Nullable @Nullable RayTraceResult rayTraceBlocks(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance, @NotNull @NotNull FluidCollisionMode fluidCollisionMode)Performs a ray trace that checks for block collisions using the blocks' precise collision shapes.This takes collisions with passable blocks into account.
This may cause loading of chunks! Some implementations may impose artificial restrictions on the maximum distance.
- Parameters:
start
- the start locationdirection
- the ray directionmaxDistance
- the maximum distancefluidCollisionMode
- the fluid collision mode- Returns:
- the ray trace hit result, or
null
if there is no hit - See Also:
rayTraceBlocks(Location, Vector, double, FluidCollisionMode, boolean)
-
rayTraceBlocks
@Nullable @Nullable RayTraceResult rayTraceBlocks(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance, @NotNull @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks)Performs a ray trace that checks for block collisions using the blocks' precise collision shapes.If collisions with passable blocks are ignored, fluid collisions are ignored as well regardless of the fluid collision mode.
Portal blocks are only considered passable if the ray starts within them. Apart from that collisions with portal blocks will be considered even if collisions with passable blocks are otherwise ignored.
This may cause loading of chunks! Some implementations may impose artificial restrictions on the maximum distance.
- Parameters:
start
- the start locationdirection
- the ray directionmaxDistance
- the maximum distancefluidCollisionMode
- the fluid collision modeignorePassableBlocks
- whether to ignore passable but collidable blocks (ex. tall grass, signs, fluids, ..)- Returns:
- the ray trace hit result, or
null
if there is no hit
-
rayTrace
@Nullable @Nullable RayTraceResult rayTrace(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance, @NotNull @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, @Nullable @Nullable Predicate<Entity> filter)Performs a ray trace that checks for both block and entity collisions.Block collisions use the blocks' precise collision shapes. The
raySize
parameter is only taken into account for entity collision checks.If collisions with passable blocks are ignored, fluid collisions are ignored as well regardless of the fluid collision mode.
Portal blocks are only considered passable if the ray starts within them. Apart from that collisions with portal blocks will be considered even if collisions with passable blocks are otherwise ignored.
This may cause loading of chunks! Some implementations may impose artificial restrictions on the maximum distance.
- Parameters:
start
- the start locationdirection
- the ray directionmaxDistance
- the maximum distancefluidCollisionMode
- the fluid collision modeignorePassableBlocks
- whether to ignore passable but collidable blocks (ex. tall grass, signs, fluids, ..)raySize
- entity bounding boxes will be uniformly expanded (or shrinked) by this value before doing collision checksfilter
- only entities that fulfill this predicate are considered, ornull
to consider all entities- Returns:
- the closest ray trace hit result with either a block or an
entity, or
null
if there is no hit
-
getSpawnLocation
Gets the default spawnLocation
of this world- Returns:
- The spawn location of this world
-
setSpawnLocation
Sets the spawn location of the world.
The location provided must be equal to this world.- Parameters:
location
- TheLocation
to set the spawn for this world at.- Returns:
- True if it was successfully set.
-
setSpawnLocation
boolean setSpawnLocation(int x, int y, int z, float angle)Sets the spawn location of the world- Parameters:
x
- X coordinatey
- Y coordinatez
- Z coordinateangle
- the angle- Returns:
- True if it was successfully set.
-
setSpawnLocation
boolean setSpawnLocation(int x, int y, int z)Sets the spawn location of the world- Parameters:
x
- X coordinatey
- Y coordinatez
- Z coordinate- Returns:
- True if it was successfully set.
-
getTime
long getTime()Gets the relative in-game time of this world.The relative time is analogous to hours * 1000
- Returns:
- The current relative time
- See Also:
Returns an absolute time of this world
-
setTime
void setTime(long time)Sets the relative in-game time on the server.The relative time is analogous to hours * 1000
Note that setting the relative time below the current relative time will actually move the clock forward a day. If you require to rewind time, please see
setFullTime(long)
- Parameters:
time
- The new relative time to set the in-game time to (in hours*1000)- See Also:
Sets the absolute time of this world
-
getFullTime
long getFullTime()Gets the full in-game time on this world- Returns:
- The current absolute time
- See Also:
Returns a relative time of this world
-
setFullTime
void setFullTime(long time)Sets the in-game time on the serverNote that this sets the full time of the world, which may cause adverse effects such as breaking redstone clocks and any scheduled events
- Parameters:
time
- The new absolute time to set this world to- See Also:
Sets the relative time of this world
-
isDayTime
boolean isDayTime()Check if it is currently daytime in this world- Returns:
- True if it is daytime
-
getGameTime
long getGameTime()Gets the full in-game time on this world since the world generation- Returns:
- The current absolute time since the world generation
- See Also:
Returns a relative time of this world
,Returns an absolute time of this world
-
hasStorm
boolean hasStorm()Returns whether the world has an ongoing storm.- Returns:
- Whether there is an ongoing storm
-
setStorm
void setStorm(boolean hasStorm)Set whether there is a storm. A duration will be set for the new current conditions. This will implicitly callsetClearWeatherDuration(int)
with 0 ticks to reset the world's clear weather.- Parameters:
hasStorm
- Whether there is rain and snow
-
getWeatherDuration
int getWeatherDuration()Get the remaining time in ticks of the current conditions.- Returns:
- Time in ticks
-
setWeatherDuration
void setWeatherDuration(int duration)Set the remaining time in ticks of the current conditions.- Parameters:
duration
- Time in ticks
-
isThundering
boolean isThundering()Returns whether there is thunder.- Returns:
- Whether there is thunder
-
setThundering
void setThundering(boolean thundering)Set whether it is thundering. This will implicitly callsetClearWeatherDuration(int)
with 0 ticks to reset the world's clear weather.- Parameters:
thundering
- Whether it is thundering
-
getThunderDuration
int getThunderDuration()Get the thundering duration.- Returns:
- Duration in ticks
-
setThunderDuration
void setThunderDuration(int duration)Set the thundering duration.- Parameters:
duration
- Duration in ticks
-
isClearWeather
boolean isClearWeather()Returns whether the world has clear weather. This will be true such thatisThundering()
andhasStorm()
are both false.- Returns:
- true if clear weather
-
setClearWeatherDuration
void setClearWeatherDuration(int duration)Set the clear weather duration. The clear weather ticks determine whether or not the world will be allowed to rain or storm. If clear weather ticks are > 0, the world will not naturally do either until the duration has elapsed. This method is equivalent to calling/weather clear
with a set amount of ticks.- Parameters:
duration
- duration in ticks
-
getClearWeatherDuration
int getClearWeatherDuration()Get the clear weather duration.- Returns:
- duration in ticks
-
createExplosion
boolean createExplosion(double x, double y, double z, float power)Creates explosion at given coordinates with given power- Parameters:
x
- X coordinatey
- Y coordinatez
- Z coordinatepower
- The power of explosion, where 4F is TNT- Returns:
- false if explosion was canceled, otherwise true
-
createExplosion
boolean createExplosion(double x, double y, double z, float power, boolean setFire)Creates explosion at given coordinates with given power and optionally setting blocks on fire.- Parameters:
x
- X coordinatey
- Y coordinatez
- Z coordinatepower
- The power of explosion, where 4F is TNTsetFire
- Whether or not to set blocks on fire- Returns:
- false if explosion was canceled, otherwise true
-
createExplosion
boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks)Creates explosion at given coordinates with given power and optionally setting blocks on fire or breaking blocks.- Parameters:
x
- X coordinatey
- Y coordinatez
- Z coordinatepower
- The power of explosion, where 4F is TNTsetFire
- Whether or not to set blocks on firebreakBlocks
- Whether or not to have blocks be destroyed- Returns:
- false if explosion was canceled, otherwise true
-
createExplosion
boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, @Nullable @Nullable Entity source)Creates explosion at given coordinates with given power and optionally setting blocks on fire or breaking blocks.- Parameters:
x
- X coordinatey
- Y coordinatez
- Z coordinatepower
- The power of explosion, where 4F is TNTsetFire
- Whether or not to set blocks on firebreakBlocks
- Whether or not to have blocks be destroyedsource
- the source entity, used for tracking damage- Returns:
- false if explosion was canceled, otherwise true
-
createExplosion
Creates explosion at given coordinates with given power- Parameters:
loc
- Location to blow uppower
- The power of explosion, where 4F is TNT- Returns:
- false if explosion was canceled, otherwise true
-
createExplosion
Creates explosion at given coordinates with given power and optionally setting blocks on fire.- Parameters:
loc
- Location to blow uppower
- The power of explosion, where 4F is TNTsetFire
- Whether or not to set blocks on fire- Returns:
- false if explosion was canceled, otherwise true
-
createExplosion
boolean createExplosion(@Nullable @Nullable Entity source, @NotNull @NotNull Location loc, float power, boolean setFire, boolean breakBlocks)Creates explosion at given location with given power and optionally setting blocks on fire, with the specified entity as the source.- Parameters:
source
- The source entity of the explosionloc
- Location to blow uppower
- The power of explosion, where 4F is TNTsetFire
- Whether or not to set blocks on firebreakBlocks
- Whether or not to have blocks be destroyed- Returns:
- false if explosion was canceled, otherwise true
-
createExplosion
default boolean createExplosion(@Nullable @Nullable Entity source, @NotNull @NotNull Location loc, float power, boolean setFire)Creates explosion at given location with given power and optionally setting blocks on fire, with the specified entity as the source. Will destroy other blocks- Parameters:
source
- The source entity of the explosionloc
- Location to blow uppower
- The power of explosion, where 4F is TNTsetFire
- Whether or not to set blocks on fire- Returns:
- false if explosion was canceled, otherwise true
-
createExplosion
default boolean createExplosion(@Nullable @Nullable Entity source, @NotNull @NotNull Location loc, float power)Creates explosion at given location with given power, with the specified entity as the source. Will set blocks on fire and destroy blocks.- Parameters:
source
- The source entity of the explosionloc
- Location to blow uppower
- The power of explosion, where 4F is TNT- Returns:
- false if explosion was canceled, otherwise true
-
createExplosion
default boolean createExplosion(@NotNull @NotNull Entity source, float power, boolean setFire, boolean breakBlocks)Creates explosion at given entities location with given power and optionally setting blocks on fire, with the specified entity as the source.- Parameters:
source
- The source entity of the explosionpower
- The power of explosion, where 4F is TNTsetFire
- Whether or not to set blocks on firebreakBlocks
- Whether or not to have blocks be destroyed- Returns:
- false if explosion was canceled, otherwise true
-
createExplosion
Creates explosion at given entities location with given power and optionally setting blocks on fire, with the specified entity as the source. Will destroy blocks.- Parameters:
source
- The source entity of the explosionpower
- The power of explosion, where 4F is TNTsetFire
- Whether or not to set blocks on fire- Returns:
- false if explosion was canceled, otherwise true
-
createExplosion
Creates explosion at given entities location with given power and optionally setting blocks on fire, with the specified entity as the source.- Parameters:
source
- The source entity of the explosionpower
- The power of explosion, where 4F is TNT- Returns:
- false if explosion was canceled, otherwise true
-
createExplosion
boolean createExplosion(@NotNull @NotNull Location loc, float power, boolean setFire, boolean breakBlocks)Creates explosion at given coordinates with given power and optionally setting blocks on fire or breaking blocks.- Parameters:
loc
- Location to blow uppower
- The power of explosion, where 4F is TNTsetFire
- Whether or not to set blocks on firebreakBlocks
- Whether or not to have blocks be destroyed- Returns:
- false if explosion was canceled, otherwise true
-
createExplosion
boolean createExplosion(@NotNull @NotNull Location loc, float power, boolean setFire, boolean breakBlocks, @Nullable @Nullable Entity source)Creates explosion at given coordinates with given power and optionally setting blocks on fire or breaking blocks.- Parameters:
loc
- Location to blow uppower
- The power of explosion, where 4F is TNTsetFire
- Whether or not to set blocks on firebreakBlocks
- Whether or not to have blocks be destroyedsource
- the source entity, used for tracking damage- Returns:
- false if explosion was canceled, otherwise true
-
getPVP
boolean getPVP()Gets the current PVP setting for this world.- Returns:
- True if PVP is enabled
-
setPVP
void setPVP(boolean pvp)Sets the PVP setting for this world.- Parameters:
pvp
- True/False whether PVP should be Enabled.
-
getGenerator
Gets the chunk generator for this world- Returns:
- ChunkGenerator associated with this world
-
getBiomeProvider
Gets the biome provider for this world- Returns:
- BiomeProvider associated with this world
-
save
void save()Saves world to disk -
getPopulators
Gets a list of all appliedBlockPopulator
s for this World- Returns:
- List containing any or none BlockPopulators
-
spawnFallingBlock
@NotNull @NotNull FallingBlock spawnFallingBlock(@NotNull @NotNull Location location, @NotNull @NotNull MaterialData data) throws IllegalArgumentExceptionSpawn aFallingBlock
entity at the givenLocation
of the specifiedMaterial
. The material dictates what is falling. When the FallingBlock hits the ground, it will place that block.The Material must be a block type, check with
material.isBlock()
. The Material may not be air.- Parameters:
location
- TheLocation
to spawn the FallingBlockdata
- The block data- Returns:
- The spawned
FallingBlock
instance - Throws:
IllegalArgumentException
- ifLocation
orMaterialData
are null orMaterial
of theMaterialData
is not a block
-
spawnFallingBlock
@NotNull @NotNull FallingBlock spawnFallingBlock(@NotNull @NotNull Location location, @NotNull @NotNull BlockData data) throws IllegalArgumentExceptionSpawn aFallingBlock
entity at the givenLocation
of the specifiedMaterial
. The material dictates what is falling. When the FallingBlock hits the ground, it will place that block.The Material must be a block type, check with
material.isBlock()
. The Material may not be air.- Parameters:
location
- TheLocation
to spawn the FallingBlockdata
- The block data- Returns:
- The spawned
FallingBlock
instance - Throws:
IllegalArgumentException
- ifLocation
orBlockData
are null
-
spawnFallingBlock
@Deprecated @NotNull @NotNull FallingBlock spawnFallingBlock(@NotNull @NotNull Location location, @NotNull @NotNull Material material, byte data) throws IllegalArgumentExceptionDeprecated.Magic valueSpawn aFallingBlock
entity at the givenLocation
of the specifiedMaterial
. The material dictates what is falling. When the FallingBlock hits the ground, it will place that block.The Material must be a block type, check with
material.isBlock()
. The Material may not be air.- Parameters:
location
- TheLocation
to spawn the FallingBlockmaterial
- The blockMaterial
typedata
- The block data- Returns:
- The spawned
FallingBlock
instance - Throws:
IllegalArgumentException
- ifLocation
orMaterial
are null orMaterial
is not a block
-
playEffect
Plays an effect to all players within a default radius around a given location. -
playEffect
void playEffect(@NotNull @NotNull Location location, @NotNull @NotNull Effect effect, int data, int radius)Plays an effect to all players within a given radius around a location. -
playEffect
<T> void playEffect(@NotNull @NotNull Location location, @NotNull @NotNull Effect effect, @Nullable T data)Plays an effect to all players within a default radius around a given location. -
playEffect
<T> void playEffect(@NotNull @NotNull Location location, @NotNull @NotNull Effect effect, @Nullable T data, int radius)Plays an effect to all players within a given radius around a location. -
getEmptyChunkSnapshot
@NotNull @NotNull ChunkSnapshot getEmptyChunkSnapshot(int x, int z, boolean includeBiome, boolean includeBiomeTemp)Get empty chunk snapshot (equivalent to all air blocks), optionally including valid biome data. Used for representing an ungenerated chunk, or for fetching only biome data without loading a chunk.- Parameters:
x
- - chunk x coordinatez
- - chunk z coordinateincludeBiome
- - if true, snapshot includes per-coordinate biome typeincludeBiomeTemp
- - if true, snapshot includes per-coordinate raw biome temperature- Returns:
- The empty snapshot.
-
setSpawnFlags
void setSpawnFlags(boolean allowMonsters, boolean allowAnimals)Sets the spawn flags for this.- Parameters:
allowMonsters
- - if true, monsters are allowed to spawn in this world.allowAnimals
- - if true, animals are allowed to spawn in this world.
-
getAllowAnimals
boolean getAllowAnimals()Gets whether animals can spawn in this world.- Returns:
- whether animals can spawn in this world.
-
getAllowMonsters
boolean getAllowMonsters()Gets whether monsters can spawn in this world.- Returns:
- whether monsters can spawn in this world.
-
getBiome
Deprecated.biomes are now 3-dimensionalGets the biome for the given block coordinates.- Parameters:
x
- X coordinate of the blockz
- Z coordinate of the block- Returns:
- Biome of the requested block
-
setBiome
Deprecated.biomes are now 3-dimensionalSets the biome for the given block coordinates- Parameters:
x
- X coordinate of the blockz
- Z coordinate of the blockbio
- new Biome type for this block
-
getTemperature
Deprecated.biomes are now 3-dimensionalGets the temperature for the given block coordinates.It is safe to run this method when the block does not exist, it will not create the block.
This method will return the raw temperature without adjusting for block height effects.
- Parameters:
x
- X coordinate of the blockz
- Z coordinate of the block- Returns:
- Temperature of the requested block
-
getTemperature
double getTemperature(int x, int y, int z)Gets the temperature for the given block coordinates.It is safe to run this method when the block does not exist, it will not create the block.
This method will return the raw temperature without adjusting for block height effects.
- Parameters:
x
- X coordinate of the blocky
- Y coordinate of the blockz
- Z coordinate of the block- Returns:
- Temperature of the requested block
-
getHumidity
Deprecated.biomes are now 3-dimensionalGets the humidity for the given block coordinates.It is safe to run this method when the block does not exist, it will not create the block.
- Parameters:
x
- X coordinate of the blockz
- Z coordinate of the block- Returns:
- Humidity of the requested block
-
getHumidity
double getHumidity(int x, int y, int z)Gets the humidity for the given block coordinates.It is safe to run this method when the block does not exist, it will not create the block.
- Parameters:
x
- X coordinate of the blocky
- Y coordinate of the blockz
- Z coordinate of the block- Returns:
- Humidity of the requested block
-
getLogicalHeight
int getLogicalHeight()Gets the maximum height to which chorus fruits and nether portals can bring players within this dimension. This excludes portals that were already built above the limit as they still connect normally. May not be greater thanWorldInfo.getMaxHeight()
.- Returns:
- maximum logical height for chorus fruits and nether portals
-
isNatural
boolean isNatural()Gets if this world is natural. When false, compasses spin randomly, and using a bed to set the respawn point or sleep, is disabled. When true, nether portals can spawn zombified piglins.- Returns:
- true if world is natural
-
isBedWorks
boolean isBedWorks()Gets if beds work in this world. A non-working bed will blow up when trying to sleep.isNatural()
defines if a bed can be used to set spawn point.- Returns:
- true if beds work in this world
-
hasSkyLight
boolean hasSkyLight()Gets if this world has skylight access.- Returns:
- true if this world has skylight access
-
hasCeiling
boolean hasCeiling()Gets if this world has a ceiling.- Returns:
- true if this world has a bedrock ceiling
-
isPiglinSafe
boolean isPiglinSafe()Gets if this world allow to piglins to survive without shaking and transforming to zombified piglins.- Returns:
- true if piglins will not transform to zombified piglins
-
isRespawnAnchorWorks
boolean isRespawnAnchorWorks()Gets if this world allows players to charge and use respawn anchors.- Returns:
- true if players can charge and use respawn anchors
-
hasRaids
boolean hasRaids()Gets if players with the bad omen effect in this world will trigger a raid.- Returns:
- true if raids will be triggered
-
isUltraWarm
boolean isUltraWarm()Gets if various water/lava mechanics will be triggered in this world, eg:
- Water is evaporated
- Sponges dry
- Lava spreads faster and further
- Returns:
- true if this world has the above mechanics
-
getSeaLevel
int getSeaLevel()Gets the sea level for this world.This is often half of
WorldInfo.getMaxHeight()
- Returns:
- Sea level
-
getKeepSpawnInMemory
boolean getKeepSpawnInMemory()Gets whether the world's spawn area should be kept loaded into memory or not.- Returns:
- true if the world's spawn area will be kept loaded into memory.
-
setKeepSpawnInMemory
void setKeepSpawnInMemory(boolean keepLoaded)Sets whether the world's spawn area should be kept loaded into memory or not.- Parameters:
keepLoaded
- if true then the world's spawn area will be kept loaded into memory.
-
isAutoSave
boolean isAutoSave()Gets whether or not the world will automatically save- Returns:
- true if the world will automatically save, otherwise false
-
setAutoSave
void setAutoSave(boolean value)Sets whether or not the world will automatically save- Parameters:
value
- true if the world should automatically save, otherwise false
-
setDifficulty
Sets the Difficulty of the world.- Parameters:
difficulty
- the new difficulty you want to set the world to
-
getDifficulty
Gets the Difficulty of the world.- Returns:
- The difficulty of the world.
-
getWorldFolder
Gets the folder of this world on disk.- Returns:
- The folder of this world.
-
getWorldType
Deprecated.world type is only used to select the default word generation settings and is not stored in Vanilla worlds, making it impossible for this method to always return the correct value.Gets the type of this world.- Returns:
- Type of this world.
-
canGenerateStructures
boolean canGenerateStructures()Gets whether or not structures are being generated.- Returns:
- True if structures are being generated.
-
isHardcore
boolean isHardcore()Gets whether the world is hardcore or not. In a hardcore world the difficulty is locked to hard.- Returns:
- hardcore status
-
setHardcore
void setHardcore(boolean hardcore)Sets whether the world is hardcore or not. In a hardcore world the difficulty is locked to hard.- Parameters:
hardcore
- Whether the world is hardcore
-
getTicksPerAnimalSpawns
long getTicksPerAnimalSpawns()Gets the world's ticks per animal spawns valueThis value determines how many ticks there are between attempts to spawn animals.
Example Usage:
- A value of 1 will mean the server will attempt to spawn animals in this world every tick.
- A value of 400 will mean the server will attempt to spawn animals in this world every 400th tick.
- A value below 0 will be reset back to Minecraft's default.
Note: If set to 0, animal spawning will be disabled for this world. We recommend using
setSpawnFlags(boolean, boolean)
to control this instead.Minecraft default: 400.
- Returns:
- The world's ticks per animal spawns value
-
setTicksPerAnimalSpawns
void setTicksPerAnimalSpawns(int ticksPerAnimalSpawns)Sets the world's ticks per animal spawns valueThis value determines how many ticks there are between attempts to spawn animals.
Example Usage:
- A value of 1 will mean the server will attempt to spawn animals in this world every tick.
- A value of 400 will mean the server will attempt to spawn animals in this world every 400th tick.
- A value below 0 will be reset back to Minecraft's default.
Note: If set to 0, animal spawning will be disabled for this world. We recommend using
setSpawnFlags(boolean, boolean)
to control this instead.Minecraft default: 400.
- Parameters:
ticksPerAnimalSpawns
- the ticks per animal spawns value you want to set the world to
-
getTicksPerMonsterSpawns
long getTicksPerMonsterSpawns()Gets the world's ticks per monster spawns valueThis value determines how many ticks there are between attempts to spawn monsters.
Example Usage:
- A value of 1 will mean the server will attempt to spawn monsters in this world every tick.
- A value of 400 will mean the server will attempt to spawn monsters in this world every 400th tick.
- A value below 0 will be reset back to Minecraft's default.
Note: If set to 0, monsters spawning will be disabled for this world. We recommend using
setSpawnFlags(boolean, boolean)
to control this instead.Minecraft default: 1.
- Returns:
- The world's ticks per monster spawns value
-
setTicksPerMonsterSpawns
void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns)Sets the world's ticks per monster spawns valueThis value determines how many ticks there are between attempts to spawn monsters.
Example Usage:
- A value of 1 will mean the server will attempt to spawn monsters in this world on every tick.
- A value of 400 will mean the server will attempt to spawn monsters in this world every 400th tick.
- A value below 0 will be reset back to Minecraft's default.
Note: If set to 0, monsters spawning will be disabled for this world. We recommend using
setSpawnFlags(boolean, boolean)
to control this instead.Minecraft default: 1.
- Parameters:
ticksPerMonsterSpawns
- the ticks per monster spawns value you want to set the world to
-
getTicksPerWaterSpawns
long getTicksPerWaterSpawns()Gets the world's ticks per water mob spawns valueThis value determines how many ticks there are between attempts to spawn water mobs.
Example Usage:
- A value of 1 will mean the server will attempt to spawn water mobs in this world every tick.
- A value of 400 will mean the server will attempt to spawn water mobs in this world every 400th tick.
- A value below 0 will be reset back to Minecraft's default.
Note: If set to 0, water mobs spawning will be disabled for this world.
Minecraft default: 1.
- Returns:
- The world's ticks per water mob spawns value
-
setTicksPerWaterSpawns
void setTicksPerWaterSpawns(int ticksPerWaterSpawns)Sets the world's ticks per water mob spawns valueThis value determines how many ticks there are between attempts to spawn water mobs.
Example Usage:
- A value of 1 will mean the server will attempt to spawn water mobs in this world on every tick.
- A value of 400 will mean the server will attempt to spawn water mobs in this world every 400th tick.
- A value below 0 will be reset back to Minecraft's default.
Note: If set to 0, water mobs spawning will be disabled for this world.
Minecraft default: 1.
- Parameters:
ticksPerWaterSpawns
- the ticks per water mob spawns value you want to set the world to
-
getTicksPerWaterAmbientSpawns
long getTicksPerWaterAmbientSpawns()Gets the default ticks per water ambient mob spawns value.Example Usage:
- A value of 1 will mean the server will attempt to spawn water ambient mobs every tick.
- A value of 400 will mean the server will attempt to spawn water ambient mobs every 400th tick.
- A value below 0 will be reset back to Minecraft's default.
Note: If set to 0, ambient mobs spawning will be disabled.
Minecraft default: 1.
- Returns:
- the default ticks per water ambient mobs spawn value
-
setTicksPerWaterAmbientSpawns
void setTicksPerWaterAmbientSpawns(int ticksPerAmbientSpawns)Sets the world's ticks per water ambient mob spawns valueThis value determines how many ticks there are between attempts to spawn water ambient mobs.
Example Usage:
- A value of 1 will mean the server will attempt to spawn water ambient mobs in this world on every tick.
- A value of 400 will mean the server will attempt to spawn weater ambient mobs in this world every 400th tick.
- A value below 0 will be reset back to Minecraft's default.
Note: If set to 0, water ambient mobs spawning will be disabled for this world.
Minecraft default: 1.
- Parameters:
ticksPerAmbientSpawns
- the ticks per water ambient mob spawns value you want to set the world to
-
getTicksPerWaterUndergroundCreatureSpawns
long getTicksPerWaterUndergroundCreatureSpawns()Gets the default ticks per water underground creature spawns value.Example Usage:
- A value of 1 will mean the server will attempt to spawn water underground creature every tick.
- A value of 400 will mean the server will attempt to spawn water underground creature every 400th tick.
- A value below 0 will be reset back to Minecraft's default.
Note: If set to 0, water underground creature spawning will be disabled.
Minecraft default: 1.
- Returns:
- the default ticks per water underground creature spawn value
-
setTicksPerWaterUndergroundCreatureSpawns
void setTicksPerWaterUndergroundCreatureSpawns(int ticksPerWaterUndergroundCreatureSpawns)Sets the world's ticks per water underground creature spawns valueThis value determines how many ticks there are between attempts to spawn water underground creature.
Example Usage:
- A value of 1 will mean the server will attempt to spawn water underground creature in this world on every tick.
- A value of 400 will mean the server will attempt to spawn water underground creature in this world every 400th tick.
- A value below 0 will be reset back to Minecraft's default.
Note: If set to 0, water underground creature spawning will be disabled for this world.
Minecraft default: 1.
- Parameters:
ticksPerWaterUndergroundCreatureSpawns
- the ticks per water underground creature spawns value you want to set the world to
-
getTicksPerAmbientSpawns
long getTicksPerAmbientSpawns()Gets the world's ticks per ambient mob spawns valueThis value determines how many ticks there are between attempts to spawn ambient mobs.
Example Usage:
- A value of 1 will mean the server will attempt to spawn ambient mobs in this world every tick.
- A value of 400 will mean the server will attempt to spawn ambient mobs in this world every 400th tick.
- A value below 0 will be reset back to Minecraft's default.
Note: If set to 0, ambient mobs spawning will be disabled for this world.
Minecraft default: 1.
- Returns:
- The world's ticks per ambient mob spawns value
-
setTicksPerAmbientSpawns
void setTicksPerAmbientSpawns(int ticksPerAmbientSpawns)Sets the world's ticks per ambient mob spawns valueThis value determines how many ticks there are between attempts to spawn ambient mobs.
Example Usage:
- A value of 1 will mean the server will attempt to spawn ambient mobs in this world on every tick.
- A value of 400 will mean the server will attempt to spawn ambient mobs in this world every 400th tick.
- A value below 0 will be reset back to Minecraft's default.
Note: If set to 0, ambient mobs spawning will be disabled for this world.
Minecraft default: 1.
- Parameters:
ticksPerAmbientSpawns
- the ticks per ambient mob spawns value you want to set the world to
-
getMonsterSpawnLimit
int getMonsterSpawnLimit()Gets limit for number of monsters that can spawn in a chunk in this world- Returns:
- The monster spawn limit
-
setMonsterSpawnLimit
void setMonsterSpawnLimit(int limit)Sets the limit for number of monsters that can spawn in a chunk in this worldNote: If set to a negative number the world will use the server-wide spawn limit instead.
- Parameters:
limit
- the new mob limit
-
getAnimalSpawnLimit
int getAnimalSpawnLimit()Gets the limit for number of animals that can spawn in a chunk in this world- Returns:
- The animal spawn limit
-
setAnimalSpawnLimit
void setAnimalSpawnLimit(int limit)Sets the limit for number of animals that can spawn in a chunk in this worldNote: If set to a negative number the world will use the server-wide spawn limit instead.
- Parameters:
limit
- the new mob limit
-
getWaterAnimalSpawnLimit
int getWaterAnimalSpawnLimit()Gets the limit for number of water animals that can spawn in a chunk in this world- Returns:
- The water animal spawn limit
-
setWaterAnimalSpawnLimit
void setWaterAnimalSpawnLimit(int limit)Sets the limit for number of water animals that can spawn in a chunk in this worldNote: If set to a negative number the world will use the server-wide spawn limit instead.
- Parameters:
limit
- the new mob limit
-
getWaterUndergroundCreatureSpawnLimit
int getWaterUndergroundCreatureSpawnLimit()Gets the limit for number of water underground creature that can spawn in a chunk in this world- Returns:
- The water underground creature spawn limit
-
setWaterUndergroundCreatureSpawnLimit
void setWaterUndergroundCreatureSpawnLimit(int limit)Sets the limit for number of water underground creature that can spawn in a chunk in this worldNote: If set to a negative number the world will use the server-wide spawn limit instead.
- Parameters:
limit
- the new mob limit
-
getWaterAmbientSpawnLimit
int getWaterAmbientSpawnLimit()Gets user-specified limit for number of water ambient mobs that can spawn in a chunk.- Returns:
- the water ambient spawn limit
-
setWaterAmbientSpawnLimit
void setWaterAmbientSpawnLimit(int limit)Sets the limit for number of water ambient mobs that can spawn in a chunk in this worldNote: If set to a negative number the world will use the server-wide spawn limit instead.
- Parameters:
limit
- the new mob limit
-
getAmbientSpawnLimit
int getAmbientSpawnLimit()Gets the limit for number of ambient mobs that can spawn in a chunk in this world- Returns:
- The ambient spawn limit
-
setAmbientSpawnLimit
void setAmbientSpawnLimit(int limit)Sets the limit for number of ambient mobs that can spawn in a chunk in this worldNote: If set to a negative number the world will use the server-wide spawn limit instead.
- Parameters:
limit
- the new mob limit
-
playSound
void playSound(@NotNull @NotNull Location location, @NotNull @NotNull Sound sound, float volume, float pitch)Play a Sound at the provided Location in the WorldThis function will fail silently if Location or Sound are null.
- Parameters:
location
- The location to play the soundsound
- The sound to playvolume
- The volume of the soundpitch
- The pitch of the sound
-
playSound
void playSound(@NotNull @NotNull Location location, @NotNull @NotNull String sound, float volume, float pitch)Play a Sound at the provided Location in the World.This function will fail silently if Location or Sound are null. No sound will be heard by the players if their clients do not have the respective sound for the value passed.
- Parameters:
location
- the location to play the soundsound
- the internal sound name to playvolume
- the volume of the soundpitch
- the pitch of the sound
-
playSound
void playSound(@NotNull @NotNull Location location, @NotNull @NotNull Sound sound, @NotNull @NotNull SoundCategory category, float volume, float pitch)Play a Sound at the provided Location in the World.This function will fail silently if Location or Sound are null.
- Parameters:
location
- The location to play the soundsound
- The sound to playcategory
- the category of the soundvolume
- The volume of the soundpitch
- The pitch of the sound
-
playSound
void playSound(@NotNull @NotNull Location location, @NotNull @NotNull String sound, @NotNull @NotNull SoundCategory category, float volume, float pitch)Play a Sound at the provided Location in the World.This function will fail silently if Location or Sound are null. No sound will be heard by the players if their clients do not have the respective sound for the value passed.
- Parameters:
location
- the location to play the soundsound
- the internal sound name to playcategory
- the category of the soundvolume
- the volume of the soundpitch
- the pitch of the sound
-
getGameRules
Get an array containing the names of all theGameRule
s.- Returns:
- An array of
GameRule
names.
-
getGameRuleValue
@Deprecated @Contract("null -> null; !null -> !null") @Nullable @Nullable String getGameRuleValue(@Nullable @Nullable String rule)Deprecated.usegetGameRuleValue(GameRule)
insteadGets the current state of the specified ruleWill return null if rule passed is null
- Parameters:
rule
- Rule to look up value of- Returns:
- String value of rule
-
setGameRuleValue
@Deprecated boolean setGameRuleValue(@NotNull @NotNull String rule, @NotNull @NotNull String value)Deprecated.usesetGameRule(GameRule, Object)
instead.Set the specified gamerule to specified value.The rule may attempt to validate the value passed, will return true if value was set.
If rule is null, the function will return false.
- Parameters:
rule
- Rule to setvalue
- Value to set rule to- Returns:
- True if rule was set
-
isGameRule
Checks if string is a valid game rule- Parameters:
rule
- Rule to check- Returns:
- True if rule exists
-
getGameRuleValue
Get the current value for a givenGameRule
.- Type Parameters:
T
- the GameRule's type- Parameters:
rule
- the GameRule to check- Returns:
- the current value
-
getGameRuleDefault
Get the default value for a givenGameRule
. This value is not guaranteed to match the current value.- Type Parameters:
T
- the type of GameRule- Parameters:
rule
- the rule to return a default value for- Returns:
- the default value
-
setGameRule
Set the givenGameRule
's new value.- Type Parameters:
T
- the value type of the GameRule- Parameters:
rule
- the GameRule to updatenewValue
- the new value- Returns:
- true if the value was successfully set
-
getWorldBorder
Gets the world border for this world.- Returns:
- The world border for this world.
-
spawnParticle
void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count)Spawns the particle (the number of times specified by count) at the target location.- Parameters:
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particles
-
spawnParticle
Spawns the particle (the number of times specified by count) at the target location.- Parameters:
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particles
-
spawnParticle
<T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, @Nullable T data)Spawns the particle (the number of times specified by count) at the target location.- Type Parameters:
T
- type of particle data (seeParticle.getDataType()
- Parameters:
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesdata
- the data to use for the particle or null, the type of this depends onParticle.getDataType()
-
spawnParticle
<T> void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, @Nullable T data)Spawns the particle (the number of times specified by count) at the target location.- Type Parameters:
T
- type of particle data (seeParticle.getDataType()
- Parameters:
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesdata
- the data to use for the particle or null, the type of this depends onParticle.getDataType()
-
spawnParticle
void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ)Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Parameters:
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axis
-
spawnParticle
void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ)Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Parameters:
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axis
-
spawnParticle
<T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, @Nullable T data)Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Type Parameters:
T
- type of particle data (seeParticle.getDataType()
- Parameters:
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisdata
- the data to use for the particle or null, the type of this depends onParticle.getDataType()
-
spawnParticle
<T> void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, @Nullable T data)Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Type Parameters:
T
- type of particle data (seeParticle.getDataType()
- Parameters:
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisdata
- the data to use for the particle or null, the type of this depends onParticle.getDataType()
-
spawnParticle
void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra)Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Parameters:
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- the extra data for this particle, depends on the particle used (normally speed)
-
spawnParticle
void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra)Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Parameters:
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- the extra data for this particle, depends on the particle used (normally speed)
-
spawnParticle
<T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data)Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Type Parameters:
T
- type of particle data (seeParticle.getDataType()
- Parameters:
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- the extra data for this particle, depends on the particle used (normally speed)data
- the data to use for the particle or null, the type of this depends onParticle.getDataType()
-
spawnParticle
default <T> void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data)Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Type Parameters:
T
- type of particle data (seeParticle.getDataType()
- Parameters:
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- the extra data for this particle, depends on the particle used (normally speed)data
- the data to use for the particle or null, the type of this depends onParticle.getDataType()
-
spawnParticle
default <T> void spawnParticle(@NotNull @NotNull Particle particle, @Nullable @Nullable List<Player> receivers, @NotNull @NotNull Player source, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data)Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Type Parameters:
T
- Type- Parameters:
particle
- the particle to spawnreceivers
- List of players to receive the particles, or null for all in worldsource
- Source of the particles to be used in visibility checks, or null if no player sourcex
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- the extra data for this particle, depends on the particle used (normally speed)data
- the data to use for the particle or null, the type of this depends onParticle.getDataType()
-
spawnParticle
<T> void spawnParticle(@NotNull @NotNull Particle particle, @Nullable @Nullable List<Player> receivers, @Nullable @Nullable Player source, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data, boolean force)Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Type Parameters:
T
- Type- Parameters:
particle
- the particle to spawnreceivers
- List of players to receive the particles, or null for all in worldsource
- Source of the particles to be used in visibility checks, or null if no player sourcex
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- the extra data for this particle, depends on the particle used (normally speed)data
- the data to use for the particle or null, the type of this depends onParticle.getDataType()
force
- allows the particle to be seen further away from the player and shows to players using any vanilla client particle settings
-
spawnParticle
<T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data, boolean force)Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Type Parameters:
T
- type of particle data (seeParticle.getDataType()
- Parameters:
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- the extra data for this particle, depends on the particle used (normally speed)data
- the data to use for the particle or null, the type of this depends onParticle.getDataType()
force
- whether to send the particle to players within an extended range and encourage their client to render it regardless of settings
-
spawnParticle
<T> void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data, boolean force)Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.- Type Parameters:
T
- type of particle data (seeParticle.getDataType()
- Parameters:
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- the extra data for this particle, depends on the particle used (normally speed)data
- the data to use for the particle or null, the type of this depends onParticle.getDataType()
force
- whether to send the particle to players within an extended range and encourage their client to render it regardless of settings
-
locateNearestStructure
@Nullable @Nullable Location locateNearestStructure(@NotNull @NotNull Location origin, @NotNull @NotNull StructureType structureType, int radius, boolean findUnexplored)Find the closest nearby structure of a givenStructureType
. Finding unexplored structures can, and will, block if the world is looking in chunks that gave not generated yet. This can lead to the world temporarily freezing while locating an unexplored structure.The
radius
is not a rigid square radius. Each structure may alter how many chunks to check for each iteration. Do not assume that only a radius x radius chunk area will be checked. For example,StructureType.WOODLAND_MANSION
can potentially check up to 20,000 blocks away (or more) regardless of the radius used.This will not load or generate chunks. This can also lead to instances where the server can hang if you are only looking for unexplored structures. This is because it will keep looking further and further out in order to find the structure.
- Parameters:
origin
- where to start looking for a structurestructureType
- the type of structure to findradius
- the radius, in chunks, around which to searchfindUnexplored
- true to only find unexplored structures- Returns:
- the closest
Location
, or null if no structure of the specified type exists.
-
locateNearestBiome
@Nullable @Nullable Location locateNearestBiome(@NotNull @NotNull Location origin, @NotNull @NotNull Biome biome, int radius)Locates the nearest biome based on an origin, biome type, and radius to search. Step defaults to8
.- Parameters:
origin
- Origin locationbiome
- Biome to findradius
- radius to search- Returns:
- Location of biome or null if not found in specified radius
-
locateNearestBiome
@Nullable @Nullable Location locateNearestBiome(@NotNull @NotNull Location origin, @NotNull @NotNull Biome biome, int radius, int step)Locates the nearest biome based on an origin, biome type, and radius to search and step- Parameters:
origin
- Origin locationbiome
- Biome to findradius
- radius to searchstep
- Search step 1 would mean checking every block, 8 would be every 8th block- Returns:
- Location of biome or null if not found in specified radius
-
isUltrawarm
Deprecated.useisUltraWarm()
Checks if the world:- evaporates water
- dries sponges
- has lava spread faster and further
- Returns:
- true if ultrawarm, false if not
-
getCoordinateScale
double getCoordinateScale()Gets the coordinate scaling of this world.- Returns:
- the coordinate scale
-
hasSkylight
Deprecated.usehasSkyLight()
Checks if the world has skylight access- Returns:
- whether there is skylight
-
hasBedrockCeiling
Deprecated.usehasCeiling()
Checks if the world has a bedrock ceiling- Returns:
- whether the world has a bedrock ceiling
-
doesBedWork
Deprecated.useisBedWorks()
Checks if beds work- Returns:
- whether beds work
-
doesRespawnAnchorWork
Deprecated.Checks if respawn anchors work- Returns:
- whether respawn anchors work
-
isFixedTime
boolean isFixedTime()Checks if this world has a fixed time- Returns:
- whether this world has fixed time
-
getInfiniburn
Gets the collection of materials that burn infinitely in this world.- Returns:
- the materials that will forever stay lit by fire
-
sendGameEvent
void sendGameEvent(@Nullable @Nullable Entity sourceEntity, @NotNull @NotNull GameEvent gameEvent, @NotNull @NotNull Vector position)Posts a specified game event at a location- Parameters:
sourceEntity
- optional source entitygameEvent
- the game event to postposition
- the position in the world where to post the event to listeners
-
getViewDistance
int getViewDistance()Returns the view distance used for this world.- Returns:
- the view distance used for this world
-
setViewDistance
void setViewDistance(int viewDistance)Sets the view distance for this world.- Parameters:
viewDistance
- view distance in [2, 32]
-
getNoTickViewDistance
int getNoTickViewDistance()Returns the no-tick view distance for this world.No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not be set to tick.
- Returns:
- The no-tick view distance for this world.
-
setNoTickViewDistance
void setNoTickViewDistance(int viewDistance)Sets the no-tick view distance for this world.No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not be set to tick.
- Parameters:
viewDistance
- view distance in [2, 32]
-
getSendViewDistance
int getSendViewDistance()Gets the sending view distance for this world.Sending view distance is the view distance where chunks will load in for players in this world.
- Returns:
- The sending view distance for this world.
-
setSendViewDistance
void setSendViewDistance(int viewDistance)Sets the sending view distance for this world.Sending view distance is the view distance where chunks will load in for players in this world.
- Parameters:
viewDistance
- view distance in [2, 32] or -1
-
spigot
-
locateNearestRaid
Finds the nearest raid close to the given location.- Parameters:
location
- the origin locationradius
- the radius- Returns:
- the closest
Raid
, or null if no raids were found
-
getRaids
Gets all raids that are going on over this world.- Returns:
- the list of all active raids
-
getEnderDragonBattle
Get theDragonBattle
associated with this world. If this world's environment is notWorld.Environment.THE_END
, null will be returned.If an end world, a dragon battle instance will be returned regardless of whether or not a dragon is present in the world or a fight sequence has been activated. The dragon battle instance acts as a state holder.
- Returns:
- the dragon battle instance
-