Interface World
-
- All Superinterfaces:
Metadatable,PluginMessageRecipient
public interface World extends PluginMessageRecipient, Metadatable
Represents a world, which may contain entities, chunks and blocks
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classWorld.EnvironmentRepresents various map environment types that a world may bestatic classWorld.Spigot
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description booleancanGenerateStructures()Gets whether or not structures are being generated.booleancreateExplosion(double x, double y, double z, float power)Creates explosion at given coordinates with given powerbooleancreateExplosion(double x, double y, double z, float power, boolean setFire)Creates explosion at given coordinates with given power and optionally setting blocks on fire.booleancreateExplosion(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.booleancreateExplosion(Location loc, float power)Creates explosion at given coordinates with given powerbooleancreateExplosion(Location loc, float power, boolean setFire)Creates explosion at given coordinates with given power and optionally setting blocks on fire.ItemdropItem(Location location, ItemStack item)Drops an item at the specifiedLocationItemdropItemNaturally(Location location, ItemStack item)Drops an item at the specifiedLocationwith a random offsetbooleangenerateTree(Location location, TreeType type)Creates a tree at the givenLocationbooleangenerateTree(Location loc, TreeType type, BlockChangeDelegate delegate)Creates a tree at the givenLocationbooleangetAllowAnimals()Gets whether animals can spawn in this world.booleangetAllowMonsters()Gets whether monsters can spawn in this world.intgetAmbientSpawnLimit()Gets the limit for number of ambient mobs that can spawn in a chunk in this worldintgetAnimalSpawnLimit()Gets the limit for number of animals that can spawn in a chunk in this worldBiomegetBiome(int x, int z)Gets the biome for the given block coordinates.BlockgetBlockAt(int x, int y, int z)Gets theBlockat the given coordinatesBlockgetBlockAt(Location location)ChunkgetChunkAt(int x, int z)Gets theChunkat the given coordinatesChunkgetChunkAt(Block block)ChunkgetChunkAt(Location location)DifficultygetDifficulty()Gets the Difficulty of the world.ChunkSnapshotgetEmptyChunkSnapshot(int x, int z, boolean includeBiome, boolean includeBiomeTemp)Get empty chunk snapshot (equivalent to all air blocks), optionally including valid biome data.List<Entity>getEntities()Get a list of all entities in this World<T extends Entity>
Collection<T>getEntitiesByClass(Class<T> cls)Get a collection of all entities in this World matching the given class/interface<T extends Entity>
Collection<T>getEntitiesByClass(Class<T>... classes)Deprecated.Collection<Entity>getEntitiesByClasses(Class<?>... classes)Get a collection of all entities in this World matching any of the given classes/interfacesWorld.EnvironmentgetEnvironment()Gets theWorld.Environmenttype of this worldlonggetFullTime()Gets the full in-game time on this world<T> TgetGameRuleDefault(GameRule<T> rule)Get the default value for a givenGameRule.String[]getGameRules()Get an array containing the names of all theGameRules.StringgetGameRuleValue(String rule)Deprecated.usegetGameRuleValue(GameRule)instead<T> TgetGameRuleValue(GameRule<T> rule)Get the current value for a givenGameRule.ChunkGeneratorgetGenerator()Gets the chunk generator for this worldBlockgetHighestBlockAt(int x, int z)Gets the lowest block at the given coordinates such that the block and all blocks above it are transparent for lighting purposes.BlockgetHighestBlockAt(Location location)Gets the lowest block at the givenLocationsuch that the block and all blocks above it are transparent for lighting purposes.intgetHighestBlockYAt(int x, int z)Gets the y coordinate of the lowest block at this position such that the block and all blocks above it are transparent for lighting purposes.intgetHighestBlockYAt(Location location)Gets the y coordinate of the lowest block at the givenLocationsuch that the block and all blocks above it are transparent for lighting purposes.doublegetHumidity(int x, int z)Gets the humidity for the given block coordinates.booleangetKeepSpawnInMemory()Gets whether the world's spawn area should be kept loaded into memory or not.List<LivingEntity>getLivingEntities()Get a list of all living entities in this WorldChunk[]getLoadedChunks()Gets an array of all loadedChunksintgetMaxHeight()Gets the maximum height of this world.intgetMonsterSpawnLimit()Gets limit for number of monsters that can spawn in a chunk in this worldStringgetName()Gets the unique name of this worldCollection<Entity>getNearbyEntities(Location location, double x, double y, double z)Returns a list of entities within a bounding box centered around a Location.List<Player>getPlayers()Get a list of all players in this WorldList<BlockPopulator>getPopulators()Gets a list of all appliedBlockPopulators for this WorldbooleangetPVP()Gets the current PVP setting for this world.intgetSeaLevel()Gets the sea level for this world.longgetSeed()Gets the Seed for this world.LocationgetSpawnLocation()Gets the default spawnLocationof this worlddoublegetTemperature(int x, int z)Gets the temperature for the given block coordinates.intgetThunderDuration()Get the thundering duration.longgetTicksPerAnimalSpawns()Gets the world's ticks per animal spawns valuelonggetTicksPerMonsterSpawns()Gets the world's ticks per monster spawns valuelonggetTime()Gets the relative in-game time of this world.UUIDgetUID()Gets the Unique ID of this worldintgetWaterAnimalSpawnLimit()Gets the limit for number of water animals that can spawn in a chunk in this worldintgetWeatherDuration()Get the remaining time in ticks of the current conditions.WorldBordergetWorldBorder()Gets the world border for this world.FilegetWorldFolder()Gets the folder of this world on disk.WorldTypegetWorldType()Gets the type of this world.booleanhasStorm()Returns whether the world has an ongoing storm.booleanisAutoSave()Gets whether or not the world will automatically savebooleanisChunkGenerated(int x, int z)Checks if theChunkat the specified coordinates is generatedbooleanisChunkInUse(int x, int z)Checks if theChunkat the specified coordinates is loaded and in use by one or more playersbooleanisChunkLoaded(int x, int z)Checks if theChunkat the specified coordinates is loadedbooleanisChunkLoaded(Chunk chunk)Checks if the specifiedChunkis loadedbooleanisGameRule(String rule)Checks if string is a valid game rulebooleanisThundering()Returns whether there is thunder.voidloadChunk(int x, int z)Loads theChunkat the specified coordinatesbooleanloadChunk(int x, int z, boolean generate)Loads theChunkat the specified coordinatesvoidloadChunk(Chunk chunk)Loads the specifiedChunkLocationlocateNearestStructure(Location origin, StructureType structureType, int radius, boolean findUnexplored)Find the closest nearby structure of a givenStructureType.voidplayEffect(Location location, Effect effect, int data)Plays an effect to all players within a default radius around a given location.voidplayEffect(Location location, Effect effect, int data, int radius)Plays an effect to all players within a given radius around a location.<T> voidplayEffect(Location location, Effect effect, T data)Plays an effect to all players within a default radius around a given location.<T> voidplayEffect(Location location, Effect effect, T data, int radius)Plays an effect to all players within a given radius around a location.voidplaySound(Location location, String sound, float volume, float pitch)Play a Sound at the provided Location in the World.voidplaySound(Location location, String sound, SoundCategory category, float volume, float pitch)Play a Sound at the provided Location in the World.voidplaySound(Location location, Sound sound, float volume, float pitch)Play a Sound at the provided Location in the WorldvoidplaySound(Location location, Sound sound, SoundCategory category, float volume, float pitch)Play a Sound at the provided Location in the World.booleanrefreshChunk(int x, int z)Deprecated.This method is not guaranteed to work suitably across all client implementations.booleanregenerateChunk(int x, int z)Deprecated.regenerating a single chunk is not guaranteed to produce the same chunk as before as terrain decoration may be spread across chunksvoidsave()Saves world to diskvoidsetAmbientSpawnLimit(int limit)Sets the limit for number of ambient mobs that can spawn in a chunk in this worldvoidsetAnimalSpawnLimit(int limit)Sets the limit for number of animals that can spawn in a chunk in this worldvoidsetAutoSave(boolean value)Sets whether or not the world will automatically savevoidsetBiome(int x, int z, Biome bio)Sets the biome for the given block coordinatesvoidsetDifficulty(Difficulty difficulty)Sets the Difficulty of the world.voidsetFullTime(long time)Sets the in-game time on the server<T> booleansetGameRule(GameRule<T> rule, T newValue)Set the givenGameRule's new value.booleansetGameRuleValue(String rule, String value)Deprecated.usesetGameRule(GameRule, Object)instead.voidsetKeepSpawnInMemory(boolean keepLoaded)Sets whether the world's spawn area should be kept loaded into memory or not.voidsetMonsterSpawnLimit(int limit)Sets the limit for number of monsters that can spawn in a chunk in this worldvoidsetPVP(boolean pvp)Sets the PVP setting for this world.voidsetSpawnFlags(boolean allowMonsters, boolean allowAnimals)Sets the spawn flags for this.booleansetSpawnLocation(int x, int y, int z)Sets the spawn location of the worldbooleansetSpawnLocation(Location location)Sets the spawn location of the world.voidsetStorm(boolean hasStorm)Set whether there is a storm.voidsetThunderDuration(int duration)Set the thundering duration.voidsetThundering(boolean thundering)Set whether it is thundering.voidsetTicksPerAnimalSpawns(int ticksPerAnimalSpawns)Sets the world's ticks per animal spawns valuevoidsetTicksPerMonsterSpawns(int ticksPerMonsterSpawns)Sets the world's ticks per monster spawns valuevoidsetTime(long time)Sets the relative in-game time on the server.voidsetWaterAnimalSpawnLimit(int limit)Sets the limit for number of water animals that can spawn in a chunk in this worldvoidsetWeatherDuration(int duration)Set the remaining time in ticks of the current conditions.<T extends Entity>
Tspawn(Location location, Class<T> clazz)Spawn an entity of a specific class at the givenLocation<T extends Entity>
Tspawn(Location location, Class<T> clazz, Consumer<T> function)Spawn an entity of a specific class at the givenLocation, with the supplied function run before the entity is added to the world.ArrowspawnArrow(Location location, Vector direction, float speed, float spread)<T extends Arrow>
TspawnArrow(Location location, Vector direction, float speed, float spread, Class<T> clazz)Creates an arrow entity of the given class at the givenLocationEntityspawnEntity(Location loc, EntityType type)Creates a entity at the givenLocationFallingBlockspawnFallingBlock(Location location, BlockData data)FallingBlockspawnFallingBlock(Location location, MaterialData data)FallingBlockspawnFallingBlock(Location location, Material material, byte data)Deprecated.Magic valuevoidspawnParticle(Particle particle, double x, double y, double z, int count)Spawns the particle (the number of times specified by count) at the target location.voidspawnParticle(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.voidspawnParticle(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.<T> voidspawnParticle(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> voidspawnParticle(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> voidspawnParticle(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> voidspawnParticle(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.voidspawnParticle(Particle particle, Location location, int count)Spawns the particle (the number of times specified by count) at the target location.voidspawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ)Spawns the particle (the number of times specified by count) at the target location.voidspawnParticle(Particle particle, 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> voidspawnParticle(Particle particle, 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> voidspawnParticle(Particle particle, 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> voidspawnParticle(Particle particle, 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> voidspawnParticle(Particle particle, Location location, int count, T data)Spawns the particle (the number of times specified by count) at the target location.World.Spigotspigot()LightningStrikestrikeLightning(Location loc)Strikes lightning at the givenLocationLightningStrikestrikeLightningEffect(Location loc)Strikes lightning at the givenLocationwithout doing damagebooleanunloadChunk(int x, int z)Safely unloads and saves theChunkat the specified coordinatesbooleanunloadChunk(int x, int z, boolean save)Safely unloads and optionally saves theChunkat the specified coordinatesbooleanunloadChunk(int x, int z, boolean save, boolean safe)Deprecated.it is never safe to remove a chunk in usebooleanunloadChunk(Chunk chunk)Safely unloads and saves theChunkat the specified coordinatesbooleanunloadChunkRequest(int x, int z)Safely queues theChunkat the specified coordinates for unloadingbooleanunloadChunkRequest(int x, int z, boolean safe)Queues theChunkat the specified coordinates for unloading-
Methods inherited from interface org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
-
Methods inherited from interface org.bukkit.plugin.messaging.PluginMessageRecipient
getListeningPluginChannels, sendPluginMessage
-
-
-
-
Method Detail
-
getBlockAt
Block getBlockAt(int x, int y, int z)
Gets theBlockat 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
Block getBlockAt(Location location)
- Parameters:
location- Location of the block- Returns:
- Block at the given location
-
getHighestBlockYAt
int getHighestBlockYAt(int x, int z)Gets the y coordinate of the lowest block at this position such that the block and all blocks above it are transparent for lighting purposes.- Parameters:
x- X-coordinate of the blocksz- Z-coordinate of the blocks- Returns:
- Y-coordinate of the described block
-
getHighestBlockYAt
int getHighestBlockYAt(Location location)
Gets the y coordinate of the lowest block at the givenLocationsuch that the block and all blocks above it are transparent for lighting purposes.- Parameters:
location- Location of the blocks- Returns:
- Y-coordinate of the highest non-air block
-
getHighestBlockAt
Block getHighestBlockAt(int x, int z)
Gets the lowest block at the given coordinates such that the block and all blocks above it are transparent for lighting purposes.- Parameters:
x- X-coordinate of the blockz- Z-coordinate of the block- Returns:
- Highest non-empty block
-
getHighestBlockAt
Block getHighestBlockAt(Location location)
Gets the lowest block at the givenLocationsuch that the block and all blocks above it are transparent for lighting purposes.- Parameters:
location- Coordinates to get the highest block- Returns:
- Highest non-empty block
-
getChunkAt
Chunk getChunkAt(int x, int z)
Gets theChunkat the given coordinates- Parameters:
x- X-coordinate of the chunkz- Z-coordinate of the chunk- Returns:
- Chunk at the given coordinates
-
getChunkAt
Chunk getChunkAt(Location location)
- Parameters:
location- Location of the chunk- Returns:
- Chunk at the given location
-
getChunkAt
Chunk getChunkAt(Block block)
- Parameters:
block- Block to get the containing chunk from- Returns:
- The chunk that contains the given block
-
isChunkLoaded
boolean isChunkLoaded(Chunk chunk)
Checks if the specifiedChunkis loaded- Parameters:
chunk- The chunk to check- Returns:
- true if the chunk is loaded, otherwise false
-
getLoadedChunks
Chunk[] getLoadedChunks()
Gets an array of all loadedChunks- Returns:
- Chunk[] containing all loaded chunks
-
loadChunk
void loadChunk(Chunk chunk)
Loads the specifiedChunk- Parameters:
chunk- The chunk to load
-
isChunkLoaded
boolean isChunkLoaded(int x, int z)Checks if theChunkat 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 theChunkat 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
boolean isChunkInUse(int x, int z)Checks if theChunkat 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 theChunkat the specified coordinatesIf 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 theChunkat the specified coordinates- 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
boolean unloadChunk(Chunk chunk)
Safely unloads and saves theChunkat the specified coordinatesThis method is analogous to
unloadChunk(int, int, boolean, boolean)where safe and saveis 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 theChunkat the specified coordinatesThis method is analogous to
unloadChunk(int, int, boolean, boolean)where safe and saveis 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 theChunkat the specified coordinatesThis method is analogous to
unloadChunk(int, int, boolean, boolean)where save is true- 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
-
unloadChunk
@Deprecated boolean unloadChunk(int x, int z, boolean save, boolean safe)
Deprecated.it is never safe to remove a chunk in useUnloads and optionally saves theChunkat the specified coordinates- Parameters:
x- X-coordinate of the chunkz- Z-coordinate of the chunksave- Controls whether the chunk is savedsafe- Controls whether to unload the chunk when players are nearby- Returns:
- true if the chunk has unloaded successfully, otherwise false
-
unloadChunkRequest
boolean unloadChunkRequest(int x, int z)Safely queues theChunkat the specified coordinates for unloadingThis method is analogous to
unloadChunkRequest(int, int, boolean)where safe is true- Parameters:
x- X-coordinate of the chunkz- Z-coordinate of the chunk- Returns:
- true is the queue attempt was successful, otherwise false
-
unloadChunkRequest
boolean unloadChunkRequest(int x, int z, boolean safe)Queues theChunkat the specified coordinates for unloading- Parameters:
x- X-coordinate of the chunkz- Z-coordinate of the chunksafe- Controls whether to queue the chunk when players are nearby- Returns:
- Whether the chunk was actually queued
-
regenerateChunk
@Deprecated boolean regenerateChunk(int x, int z)
Deprecated.regenerating a single chunk is not guaranteed to produce the same chunk as before as terrain decoration may be spread across chunksRegenerates theChunkat the specified coordinates- Parameters:
x- X-coordinate of the chunkz- Z-coordinate of the chunk- Returns:
- Whether the chunk was actually regenerated
-
refreshChunk
@Deprecated boolean refreshChunk(int x, int z)
Deprecated.This method is not guaranteed to work suitably across all client implementations.Resends theChunkto all clients- Parameters:
x- X-coordinate of the chunkz- Z-coordinate of the chunk- Returns:
- Whether the chunk was actually refreshed
-
dropItem
Item dropItem(Location location, 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
-
dropItemNaturally
Item dropItemNaturally(Location location, ItemStack item)
Drops an item at the specifiedLocationwith a random offset- Parameters:
location- Location to drop the itemitem- ItemStack to drop- Returns:
- ItemDrop entity created as a result of this method
-
spawnArrow
Arrow spawnArrow(Location location, 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
<T extends Arrow> T spawnArrow(Location location, Vector direction, float speed, float spread, 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
boolean generateTree(Location location, TreeType type)
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
boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate)
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
-
spawnEntity
Entity spawnEntity(Location loc, EntityType type)
Creates a entity at the givenLocation- Parameters:
loc- The location to spawn the entitytype- The entity to spawn- Returns:
- Resulting Entity of this method, or null if it was unsuccessful
-
strikeLightning
LightningStrike strikeLightning(Location loc)
Strikes lightning at the givenLocation- Parameters:
loc- The location to strike lightning- Returns:
- The lightning entity.
-
strikeLightningEffect
LightningStrike strikeLightningEffect(Location loc)
Strikes lightning at the givenLocationwithout doing damage- Parameters:
loc- The location to strike lightning- Returns:
- The lightning entity.
-
getEntities
List<Entity> getEntities()
Get a list of all entities in this World- Returns:
- A List of all Entities currently residing in this world
-
getLivingEntities
List<LivingEntity> getLivingEntities()
Get a list of all living entities in this World- Returns:
- A List of all LivingEntities currently residing in this world
-
getEntitiesByClass
@Deprecated <T extends Entity> Collection<T> getEntitiesByClass(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
<T extends Entity> Collection<T> getEntitiesByClass(Class<T> cls)
Get a collection of all entities in this World matching the given class/interface- 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
Collection<Entity> getEntitiesByClasses(Class<?>... classes)
Get a collection of all entities in this World matching any of the given classes/interfaces- 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
-
getPlayers
List<Player> getPlayers()
Get a list of all players in this World- Returns:
- A list of all Players currently residing in this world
-
getNearbyEntities
Collection<Entity> getNearbyEntities(Location location, double x, double y, double z)
Returns a list of entities within a bounding box centered around a Location. 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.
-
getName
String getName()
Gets the unique name of this world- Returns:
- Name of this world
-
getUID
UUID getUID()
Gets the Unique ID of this world- Returns:
- Unique ID of this world.
-
getSpawnLocation
Location getSpawnLocation()
Gets the default spawnLocationof this world- Returns:
- The spawn location of this world
-
setSpawnLocation
boolean setSpawnLocation(Location location)
Sets the spawn location of the world.
The location provided must be equal to this world.- Parameters:
location- TheLocationto set the spawn for this world at.- 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
-
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.- 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.- 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
-
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(Location loc, float power)
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
boolean createExplosion(Location loc, float power, boolean setFire)
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
-
getEnvironment
World.Environment getEnvironment()
Gets theWorld.Environmenttype of this world- Returns:
- This worlds Environment type
-
getSeed
long getSeed()
Gets the Seed for this world.- Returns:
- This worlds Seed
-
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
ChunkGenerator getGenerator()
Gets the chunk generator for this world- Returns:
- ChunkGenerator associated with this world
-
save
void save()
Saves world to disk
-
getPopulators
List<BlockPopulator> getPopulators()
Gets a list of all appliedBlockPopulators for this World- Returns:
- List containing any or none BlockPopulators
-
spawn
<T extends Entity> T spawn(Location location, Class<T> clazz) throws IllegalArgumentException
Spawn an entity of a specific class at the givenLocation- Type Parameters:
T- the class of theEntityto spawn- Parameters:
location- theLocationto spawn the entity atclazz- the class of theEntityto spawn- Returns:
- an instance of the spawned
Entity - Throws:
IllegalArgumentException- if either parameter is null or theEntityrequested cannot be spawned
-
spawn
<T extends Entity> T spawn(Location location, Class<T> clazz, Consumer<T> function) throws IllegalArgumentException
Spawn an entity of a specific class at the givenLocation, with the supplied function run before the entity is added to the world.
Note that when the function is run, the entity will not be actually in the world. Any operation involving such as teleporting the entity is undefined until after this function returns.- Type Parameters:
T- the class of theEntityto spawn- Parameters:
location- theLocationto spawn the entity atclazz- the class of theEntityto spawnfunction- the function to be run before the entity is spawned.- Returns:
- an instance of the spawned
Entity - Throws:
IllegalArgumentException- if either parameter is null or theEntityrequested cannot be spawned
-
spawnFallingBlock
FallingBlock spawnFallingBlock(Location location, MaterialData data) throws IllegalArgumentException
Spawn aFallingBlockentity at the givenLocationof 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- TheLocationto spawn the FallingBlockdata- The block data- Returns:
- The spawned
FallingBlockinstance - Throws:
IllegalArgumentException- ifLocationorMaterialDataare null orMaterialof theMaterialDatais not a block
-
spawnFallingBlock
FallingBlock spawnFallingBlock(Location location, BlockData data) throws IllegalArgumentException
Spawn aFallingBlockentity at the givenLocationof 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- TheLocationto spawn the FallingBlockdata- The block data- Returns:
- The spawned
FallingBlockinstance - Throws:
IllegalArgumentException- ifLocationorBlockDataare null
-
spawnFallingBlock
@Deprecated FallingBlock spawnFallingBlock(Location location, Material material, byte data) throws IllegalArgumentException
Deprecated.Magic valueSpawn aFallingBlockentity at the givenLocationof 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- TheLocationto spawn the FallingBlockmaterial- The blockMaterialtypedata- The block data- Returns:
- The spawned
FallingBlockinstance - Throws:
IllegalArgumentException- ifLocationorMaterialare null orMaterialis not a block
-
playEffect
void playEffect(Location location, Effect effect, int data)
Plays an effect to all players within a default radius around a given location.
-
playEffect
void playEffect(Location location, Effect effect, int data, int radius)
Plays an effect to all players within a given radius around a location.
-
playEffect
<T> void playEffect(Location location, Effect effect, T data)
Plays an effect to all players within a default radius around a given location.
-
playEffect
<T> void playEffect(Location location, Effect effect, T data, int radius)
Plays an effect to all players within a given radius around a location.
-
getEmptyChunkSnapshot
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
Biome getBiome(int x, int z)
Gets 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
void setBiome(int x, int z, Biome bio)Sets 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
double getTemperature(int x, 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.
- Parameters:
x- X coordinate of the blockz- Z coordinate of the block- Returns:
- Temperature of the requested block
-
getHumidity
double getHumidity(int x, 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 blockz- Z coordinate of the block- Returns:
- Humidity of the requested block
-
getMaxHeight
int getMaxHeight()
Gets the maximum height of this world.If the max height is 100, there are only blocks from y=0 to y=99.
- Returns:
- Maximum height of the world
-
getSeaLevel
int getSeaLevel()
Gets the sea level for this world.This is often half of
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
void setDifficulty(Difficulty difficulty)
Sets the Difficulty of the world.- Parameters:
difficulty- the new difficulty you want to set the world to
-
getDifficulty
Difficulty getDifficulty()
Gets the Difficulty of the world.- Returns:
- The difficulty of the world.
-
getWorldFolder
File getWorldFolder()
Gets the folder of this world on disk.- Returns:
- The folder of this world.
-
getWorldType
WorldType getWorldType()
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.
-
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
-
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
-
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(Location location, 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(Location location, 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(Location location, Sound sound, 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(Location location, String sound, 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
String[] getGameRules()
Get an array containing the names of all theGameRules.- Returns:
- An array of
GameRulenames.
-
getGameRuleValue
@Deprecated String getGameRuleValue(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(String rule, 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
boolean isGameRule(String rule)
Checks if string is a valid game rule- Parameters:
rule- Rule to check- Returns:
- True if rule exists
-
getGameRuleValue
<T> T getGameRuleValue(GameRule<T> rule)
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
<T> T getGameRuleDefault(GameRule<T> rule)
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
<T> boolean setGameRule(GameRule<T> rule, T newValue)
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
WorldBorder getWorldBorder()
Gets the world border for this world.- Returns:
- The world border for this world.
-
spawnParticle
void spawnParticle(Particle particle, 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
void spawnParticle(Particle particle, double x, double y, double z, int count)
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(Particle particle, Location location, int count, T data)
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 particlesdata- the data to use for the particle or null, the type of this depends onParticle.getDataType()
-
spawnParticle
<T> void spawnParticle(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.- 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(Particle particle, 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(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(Particle particle, 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. 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 axisdata- the data to use for the particle or null, the type of this depends onParticle.getDataType()
-
spawnParticle
<T> void spawnParticle(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. 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 axisdata- the data to use for the particle or null, the type of this depends onParticle.getDataType()
-
spawnParticle
void spawnParticle(Particle particle, 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(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(Particle particle, 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. 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)data- the data to use for the particle or null, the type of this depends onParticle.getDataType()
-
spawnParticle
<T> void spawnParticle(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. 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)data- the data to use for the particle or null, the type of this depends onParticle.getDataType()
-
spawnParticle
<T> void spawnParticle(Particle particle, 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. 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)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(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. 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)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
Location locateNearestStructure(Location origin, 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
radiusis 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_MANSIONcan 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.
-
spigot
World.Spigot spigot()
-
-