org.bukkit
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
static class World.Environment
          Represents various map environment types that a world may be
 
Method Summary
 boolean canGenerateStructures()
          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 power
 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.
 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(Location loc, float power)
          Creates explosion at given coordinates with given power
 boolean createExplosion(Location loc, float power, boolean setFire)
          Creates explosion at given coordinates with given power and optionally setting blocks on fire.
 Item dropItem(Location location, ItemStack item)
          Drops an item at the specified Location
 Item dropItemNaturally(Location location, ItemStack item)
          Drops an item at the specified Location with a random offset
 boolean generateTree(Location location, TreeType type)
          Creates a tree at the given Location
 boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate)
          Creates a tree at the given Location
 boolean getAllowAnimals()
          Gets whether animals can spawn in this world.
 boolean getAllowMonsters()
          Gets whether monsters can spawn in this world.
 int getAmbientSpawnLimit()
          Gets the limit for number of ambient mobs that can spawn in a chunk in this world
 int getAnimalSpawnLimit()
          Gets the limit for number of animals that can spawn in a chunk in this world
 Biome getBiome(int x, int z)
          Gets the biome for the given block coordinates.
 Block getBlockAt(int x, int y, int z)
          Gets the Block at the given coordinates
 Block getBlockAt(Location location)
          Gets the Block at the given Location
 int getBlockTypeIdAt(int x, int y, int z)
          Deprecated. Magic value
 int getBlockTypeIdAt(Location location)
          Deprecated. Magic value
 Chunk getChunkAt(Block block)
          Gets the Chunk that contains the given Block
 Chunk getChunkAt(int x, int z)
          Gets the Chunk at the given coordinates
 Chunk getChunkAt(Location location)
          Gets the Chunk at the given Location
 Difficulty getDifficulty()
          Gets the Difficulty of the world.
 ChunkSnapshot getEmptyChunkSnapshot(int x, int z, boolean includeBiome, boolean includeBiomeTempRain)
          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>... classes)
          Deprecated. 
<T extends Entity>
Collection<T>
getEntitiesByClass(Class<T> cls)
          Get a collection of all entities in this World matching the given class/interface
 Collection<Entity> getEntitiesByClasses(Class<?>... classes)
          Get a collection of all entities in this World matching any of the given classes/interfaces
 World.Environment getEnvironment()
          Gets the World.Environment type of this world
 long getFullTime()
          Gets the full in-game time on this world
 String[] getGameRules()
          Get existing rules
 String getGameRuleValue(String rule)
          Gets the current state of the specified rule
 ChunkGenerator getGenerator()
          Gets the chunk generator for this world
 Block getHighestBlockAt(int x, int z)
          Gets the highest non-empty block at the given coordinates
 Block getHighestBlockAt(Location location)
          Gets the highest non-empty block at the given coordinates
 int getHighestBlockYAt(int x, int z)
          Gets the highest non-air coordinate at the given coordinates
 int getHighestBlockYAt(Location location)
          Gets the highest non-air coordinate at the given Location
 double getHumidity(int x, int z)
          Gets the humidity for the given block coordinates.
 boolean getKeepSpawnInMemory()
          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 World
 Chunk[] getLoadedChunks()
          Gets an array of all loaded Chunks
 int getMaxHeight()
          Gets the maximum height of this world.
 int getMonsterSpawnLimit()
          Gets limit for number of monsters that can spawn in a chunk in this world
 String getName()
          Gets the unique name of this world
 List<Player> getPlayers()
          Get a list of all players in this World
 List<BlockPopulator> getPopulators()
          Gets a list of all applied BlockPopulators for this World
 boolean getPVP()
          Gets the current PVP setting for this world.
 int getSeaLevel()
          Gets the sea level for this world.
 long getSeed()
          Gets the Seed for this world.
 Location getSpawnLocation()
          Gets the default spawn Location of this world
 double getTemperature(int x, int z)
          Gets the temperature for the given block coordinates.
 int getThunderDuration()
          Get the thundering duration.
 long getTicksPerAnimalSpawns()
          Gets the world's ticks per animal spawns value
 long getTicksPerMonsterSpawns()
          Gets the world's ticks per monster spawns value
 long getTime()
          Gets the relative in-game time of this world.
 UUID getUID()
          Gets the Unique ID of this world
 int getWaterAnimalSpawnLimit()
          Gets the limit for number of water animals that can spawn in a chunk in this world
 int getWeatherDuration()
          Get the remaining time in ticks of the current conditions.
 File getWorldFolder()
          Gets the folder of this world on disk.
 WorldType getWorldType()
          Gets the type of this world.
 boolean hasStorm()
          Returns whether the world has an ongoing storm.
 boolean isAutoSave()
          Gets whether or not the world will automatically save
 boolean isChunkInUse(int x, int z)
          Checks if the Chunk at the specified coordinates is loaded and in use by one or more players
 boolean isChunkLoaded(Chunk chunk)
          Checks if the specified Chunk is loaded
 boolean isChunkLoaded(int x, int z)
          Checks if the Chunk at the specified coordinates is loaded
 boolean isGameRule(String rule)
          Checks if string is a valid game rule
 boolean isThundering()
          Returns whether there is thunder.
 void loadChunk(Chunk chunk)
          Loads the specified Chunk
 void loadChunk(int x, int z)
          Loads the Chunk at the specified coordinates
 boolean loadChunk(int x, int z, boolean generate)
          Loads the Chunk at the specified coordinates
 void playEffect(Location location, Effect effect, int data)
          Plays an effect to all players within a default radius around a given location.
 void playEffect(Location location, Effect effect, int data, int radius)
          Plays an effect to all players within a given radius around a location.
<T> void
playEffect(Location location, Effect effect, T data)
          Plays an effect to all players within a default radius around a given location.
<T> void
playEffect(Location location, Effect effect, T data, int radius)
          Plays an effect to all players within a given radius around a location.
 void playSound(Location location, Sound sound, float volume, float pitch)
          Play a Sound at the provided Location in the World
 boolean refreshChunk(int x, int z)
          Resends the Chunk to all clients
 boolean regenerateChunk(int x, int z)
          Regenerates the Chunk at the specified coordinates
 void save()
          Saves world to disk
 void setAmbientSpawnLimit(int limit)
          Sets the limit for number of ambient mobs that can spawn in a chunk in this world
 void setAnimalSpawnLimit(int limit)
          Sets the limit for number of animals that can spawn in a chunk in this world
 void setAutoSave(boolean value)
          Sets whether or not the world will automatically save
 void setBiome(int x, int z, Biome bio)
          Sets the biome for the given block coordinates
 void setDifficulty(Difficulty difficulty)
          Sets the Difficulty of the world.
 void setFullTime(long time)
          Sets the in-game time on the server
 boolean setGameRuleValue(String rule, String value)
          Set the specified gamerule to specified value.
 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 world
 void setPVP(boolean pvp)
          Sets the PVP setting 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 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 setTicksPerAnimalSpawns(int ticksPerAnimalSpawns)
          Sets the world's ticks per animal spawns value
 void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns)
          Sets the world's ticks per monster spawns value
 void setTime(long time)
          Sets the relative in-game time on the server.
 void setWaterAnimalSpawnLimit(int limit)
          Sets the limit for number of water animals that can spawn in a chunk in this world
 void setWeatherDuration(int duration)
          Set the remaining time in ticks of the current conditions.
<T extends Entity>
T
spawn(Location location, Class<T> clazz)
          Spawn an entity of a specific class at the given Location
 Arrow spawnArrow(Location location, Vector velocity, float speed, float spread)
          Creates an Arrow entity at the given Location
 LivingEntity spawnCreature(Location loc, CreatureType type)
          Deprecated. 
 LivingEntity spawnCreature(Location loc, EntityType type)
          Deprecated. Has issues spawning non LivingEntities. Use spawnEntity instead.
 Entity spawnEntity(Location loc, EntityType type)
          Creates a entity at the given Location
 FallingBlock spawnFallingBlock(Location location, int blockId, byte blockData)
          Spawn a FallingBlock entity at the given Location of the specified blockId (converted to Material)
 FallingBlock spawnFallingBlock(Location location, Material material, byte data)
          Spawn a FallingBlock entity at the given Location of the specified Material.
 LightningStrike strikeLightning(Location loc)
          Strikes lightning at the given Location
 LightningStrike strikeLightningEffect(Location loc)
          Strikes lightning at the given Location without doing damage
 boolean unloadChunk(Chunk chunk)
          Safely unloads and saves the Chunk at the specified coordinates
 boolean unloadChunk(int x, int z)
          Safely unloads and saves the Chunk at the specified coordinates
 boolean unloadChunk(int x, int z, boolean save)
          Safely unloads and optionally saves the Chunk at the specified coordinates
 boolean unloadChunk(int x, int z, boolean save, boolean safe)
          Unloads and optionally saves the Chunk at the specified coordinates
 boolean unloadChunkRequest(int x, int z)
          Safely queues the Chunk at the specified coordinates for unloading
 boolean unloadChunkRequest(int x, int z, boolean safe)
          Queues the Chunk at the specified coordinates for unloading
 
Methods inherited from interface org.bukkit.plugin.messaging.PluginMessageRecipient
getListeningPluginChannels, sendPluginMessage
 
Methods inherited from interface org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
 

Method Detail

getBlockAt

Block getBlockAt(int x,
                 int y,
                 int z)
Gets the Block at the given coordinates

Parameters:
x - X-coordinate of the block
y - Y-coordinate of the block
z - Z-coordinate of the block
Returns:
Block at the given coordinates
See Also:
Returns the current type ID of the block

getBlockAt

Block getBlockAt(Location location)
Gets the Block at the given Location

Parameters:
location - Location of the block
Returns:
Block at the given location
See Also:
Returns the current type ID of the block

getBlockTypeIdAt

@Deprecated
int getBlockTypeIdAt(int x,
                                int y,
                                int z)
Deprecated. Magic value

Gets the block type ID at the given coordinates

Parameters:
x - X-coordinate of the block
y - Y-coordinate of the block
z - Z-coordinate of the block
Returns:
Type ID of the block at the given coordinates
See Also:
Returns a live Block object at the given location

getBlockTypeIdAt

@Deprecated
int getBlockTypeIdAt(Location location)
Deprecated. Magic value

Gets the block type ID at the given Location

Parameters:
location - Location of the block
Returns:
Type ID of the block at the given location
See Also:
Returns a live Block object at the given location

getHighestBlockYAt

int getHighestBlockYAt(int x,
                       int z)
Gets the highest non-air coordinate at the given coordinates

Parameters:
x - X-coordinate of the blocks
z - Z-coordinate of the blocks
Returns:
Y-coordinate of the highest non-air block

getHighestBlockYAt

int getHighestBlockYAt(Location location)
Gets the highest non-air coordinate at the given Location

Parameters:
location - Location of the blocks
Returns:
Y-coordinate of the highest non-air block

getHighestBlockAt

Block getHighestBlockAt(int x,
                        int z)
Gets the highest non-empty block at the given coordinates

Parameters:
x - X-coordinate of the block
z - Z-coordinate of the block
Returns:
Highest non-empty block

getHighestBlockAt

Block getHighestBlockAt(Location location)
Gets the highest non-empty block at the given coordinates

Parameters:
location - Coordinates to get the highest block
Returns:
Highest non-empty block

getChunkAt

Chunk getChunkAt(int x,
                 int z)
Gets the Chunk at the given coordinates

Parameters:
x - X-coordinate of the chunk
z - Z-coordinate of the chunk
Returns:
Chunk at the given coordinates

getChunkAt

Chunk getChunkAt(Location location)
Gets the Chunk at the given Location

Parameters:
location - Location of the chunk
Returns:
Chunk at the given location

getChunkAt

Chunk getChunkAt(Block block)
Gets the Chunk that contains the given 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 specified Chunk is loaded

Parameters:
chunk - The chunk to check
Returns:
true if the chunk is loaded, otherwise false

getLoadedChunks

Chunk[] getLoadedChunks()
Gets an array of all loaded Chunks

Returns:
Chunk[] containing all loaded chunks

loadChunk

void loadChunk(Chunk chunk)
Loads the specified Chunk

Parameters:
chunk - The chunk to load

isChunkLoaded

boolean isChunkLoaded(int x,
                      int z)
Checks if the Chunk at the specified coordinates is loaded

Parameters:
x - X-coordinate of the chunk
z - Z-coordinate of the chunk
Returns:
true if the chunk is loaded, otherwise false

isChunkInUse

boolean isChunkInUse(int x,
                     int z)
Checks if the Chunk at the specified coordinates is loaded and in use by one or more players

Parameters:
x - X-coordinate of the chunk
z - 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 the Chunk at the specified coordinates

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 chunk
z - Z-coordinate of the chunk

loadChunk

boolean loadChunk(int x,
                  int z,
                  boolean generate)
Loads the Chunk at the specified coordinates

Parameters:
x - X-coordinate of the chunk
z - Z-coordinate of the chunk
generate - 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 the Chunk at the specified coordinates

This 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 the Chunk at the specified coordinates

This method is analogous to unloadChunk(int, int, boolean, boolean) where safe and saveis true

Parameters:
x - X-coordinate of the chunk
z - 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 the Chunk at the specified coordinates

This method is analogous to unloadChunk(int, int, boolean, boolean) where save is true

Parameters:
x - X-coordinate of the chunk
z - Z-coordinate of the chunk
save - Whether or not to save the chunk
Returns:
true if the chunk has unloaded successfully, otherwise false

unloadChunk

boolean unloadChunk(int x,
                    int z,
                    boolean save,
                    boolean safe)
Unloads and optionally saves the Chunk at the specified coordinates

Parameters:
x - X-coordinate of the chunk
z - Z-coordinate of the chunk
save - Controls whether the chunk is saved
safe - 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 the Chunk at the specified coordinates for unloading

This method is analogous to unloadChunkRequest(int, int, boolean) where safe is true

Parameters:
x - X-coordinate of the chunk
z - 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 the Chunk at the specified coordinates for unloading

Parameters:
x - X-coordinate of the chunk
z - Z-coordinate of the chunk
safe - Controls whether to queue the chunk when players are nearby
Returns:
Whether the chunk was actually queued

regenerateChunk

boolean regenerateChunk(int x,
                        int z)
Regenerates the Chunk at the specified coordinates

Parameters:
x - X-coordinate of the chunk
z - Z-coordinate of the chunk
Returns:
Whether the chunk was actually regenerated

refreshChunk

boolean refreshChunk(int x,
                     int z)
Resends the Chunk to all clients

Parameters:
x - X-coordinate of the chunk
z - Z-coordinate of the chunk
Returns:
Whether the chunk was actually refreshed

dropItem

Item dropItem(Location location,
              ItemStack item)
Drops an item at the specified Location

Parameters:
location - Location to drop the item
item - 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 specified Location with a random offset

Parameters:
location - Location to drop the item
item - ItemStack to drop
Returns:
ItemDrop entity created as a result of this method

spawnArrow

Arrow spawnArrow(Location location,
                 Vector velocity,
                 float speed,
                 float spread)
Creates an Arrow entity at the given Location

Parameters:
location - Location to spawn the arrow
velocity - Velocity to shoot the arrow in
speed - Speed of the arrow. A recommend speed is 0.6
spread - Spread of the arrow. A recommend spread is 12
Returns:
Arrow entity spawned as a result of this method

generateTree

boolean generateTree(Location location,
                     TreeType type)
Creates a tree at the given Location

Parameters:
location - Location to spawn the tree
type - 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 given Location

Parameters:
loc - Location to spawn the tree
type - Type of the tree to create
delegate - 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 given Location

Parameters:
loc - The location to spawn the entity
type - The entity to spawn
Returns:
Resulting Entity of this method, or null if it was unsuccessful

spawnCreature

@Deprecated
LivingEntity spawnCreature(Location loc,
                                      EntityType type)
Deprecated. Has issues spawning non LivingEntities. Use spawnEntity instead.

Creates a creature at the given Location

Parameters:
loc - The location to spawn the creature
type - The creature to spawn
Returns:
Resulting LivingEntity of this method, or null if it was unsuccessful

spawnCreature

@Deprecated
LivingEntity spawnCreature(Location loc,
                                      CreatureType type)
Deprecated. 

Creates a creature at the given Location

Parameters:
loc - The location to spawn the creature
type - The creature to spawn
Returns:
Resulting LivingEntity of this method, or null if it was unsuccessful

strikeLightning

LightningStrike strikeLightning(Location loc)
Strikes lightning at the given Location

Parameters:
loc - The location to strike lightning
Returns:
The lightning entity.

strikeLightningEffect

LightningStrike strikeLightningEffect(Location loc)
Strikes lightning at the given Location without 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

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

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

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 spawn Location of this world

Returns:
The spawn location of this world

setSpawnLocation

boolean setSpawnLocation(int x,
                         int y,
                         int z)
Sets the spawn location of the world

Parameters:
x - X coordinate
y - Y coordinate
z - 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

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 server

Note 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 coordinate
y - Y coordinate
z - Z coordinate
power - 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 coordinate
y - Y coordinate
z - Z coordinate
power - The power of explosion, where 4F is TNT
setFire - 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 coordinate
y - Y coordinate
z - Z coordinate
power - The power of explosion, where 4F is TNT
setFire - Whether or not to set blocks on fire
breakBlocks - 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 up
power - 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 up
power - The power of explosion, where 4F is TNT
setFire - Whether or not to set blocks on fire
Returns:
false if explosion was canceled, otherwise true

getEnvironment

World.Environment getEnvironment()
Gets the World.Environment type 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 applied BlockPopulators 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 given Location

Type Parameters:
T - the class of the Entity to spawn
Parameters:
location - the Location to spawn the entity at
clazz - the class of the Entity to spawn
Returns:
an instance of the spawned Entity
Throws:
IllegalArgumentException - if either parameter is null or the Entity requested cannot be spawned

spawnFallingBlock

FallingBlock spawnFallingBlock(Location location,
                               Material material,
                               byte data)
                               throws IllegalArgumentException
Spawn a FallingBlock entity at the given Location of the specified Material. 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 - The Location to spawn the FallingBlock
material - The block Material type
data - The block data
Returns:
The spawned FallingBlock instance
Throws:
IllegalArgumentException - if Location or Material are null or Material is not a block

spawnFallingBlock

FallingBlock spawnFallingBlock(Location location,
                               int blockId,
                               byte blockData)
                               throws IllegalArgumentException
Spawn a FallingBlock entity at the given Location of the specified blockId (converted to Material)

Parameters:
location - The Location to spawn the FallingBlock
blockId - The id of the intended material
blockData - The block data
Returns:
The spawned FallingBlock instance
Throws:
IllegalArgumentException - if location is null, or blockId is invalid
See Also:
spawnFallingBlock(org.bukkit.Location, org.bukkit.Material, byte)

playEffect

void playEffect(Location location,
                Effect effect,
                int data)
Plays an effect to all players within a default radius around a given location.

Parameters:
location - the Location around which players must be to hear the sound
effect - the Effect
data - a data bit needed for some effects

playEffect

void playEffect(Location location,
                Effect effect,
                int data,
                int radius)
Plays an effect to all players within a given radius around a location.

Parameters:
location - the Location around which players must be to hear the effect
effect - the Effect
data - a data bit needed for some effects
radius - the radius around the 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.

Parameters:
location - the Location around which players must be to hear the sound
effect - the Effect
data - a data bit needed for some effects

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.

Parameters:
location - the Location around which players must be to hear the effect
effect - the Effect
data - a data bit needed for some effects
radius - the radius around the location

getEmptyChunkSnapshot

ChunkSnapshot getEmptyChunkSnapshot(int x,
                                    int z,
                                    boolean includeBiome,
                                    boolean includeBiomeTempRain)
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 coordinate
z - - chunk z coordinate
includeBiome - - if true, snapshot includes per-coordinate biome type
includeBiomeTempRain - - if true, snapshot includes per-coordinate raw biome temperature and rainfall
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 block
z - 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 block
z - Z coordinate of the block
bio - 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 block
z - 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 block
z - 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 value

This value determines how many ticks there are between attempts to spawn animals.

Example Usage:

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 value

This value determines how many ticks there are between attempts to spawn animals.

Example Usage:

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 value

This value determines how many ticks there are between attempts to spawn monsters.

Example Usage:

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 value

This value determines how many ticks there are between attempts to spawn monsters.

Example Usage:

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 world

Note: If set to a negative number the world will use the server-wide spawn limit instead.


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 world

Note: If set to a negative number the world will use the server-wide spawn limit instead.


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 world

Note: If set to a negative number the world will use the server-wide spawn limit instead.


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 world

Note: If set to a negative number the world will use the server-wide spawn limit instead.


playSound

void playSound(Location location,
               Sound 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.

Parameters:
location - The location to play the sound
sound - The sound to play
volume - The volume of the sound
pitch - The pitch of the sound

getGameRules

String[] getGameRules()
Get existing rules

Returns:
An array of rules

getGameRuleValue

String getGameRuleValue(String rule)
Gets the current state of the specified rule

Will return null if rule passed is null

Parameters:
rule - Rule to look up value of
Returns:
String value of rule

setGameRuleValue

boolean setGameRuleValue(String rule,
                         String value)
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 set
value - 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


Copyright © 2014. All rights reserved.