public interface World extends PluginMessageRecipient, Metadatable
限定符和类型 | 接口和说明 |
---|---|
static class |
World.Environment
表示世界可能的各种地图环境类型.
|
限定符和类型 | 方法和说明 |
---|---|
boolean |
canGenerateStructures()
获取建筑物是否会被生成。
|
boolean |
createExplosion(double x,
double y,
double z,
float power)
在指定坐标生成指定威力的爆炸.
|
boolean |
createExplosion(double x,
double y,
double z,
float power,
boolean setFire)
在指定的坐标生成指定威力的爆炸并设置方块是否会着火.
|
boolean |
createExplosion(double x,
double y,
double z,
float power,
boolean setFire,
boolean breakBlocks)
在指定的坐标生成指定威力的爆炸并设置方块是否会着火或被破坏.
|
boolean |
createExplosion(Location loc,
float power)
在指定坐标生成指定威力的爆炸.
|
boolean |
createExplosion(Location loc,
float power,
boolean setFire)
在指定的坐标生成指定威力的爆炸并设置方块是否会着火.
|
Item |
dropItem(Location location,
ItemStack item)
在指定的
位置 丢出一个物品. |
Item |
dropItemNaturally(Location location,
ItemStack item)
在指定的
位置 丢出一个随机偏移的物品. |
boolean |
generateTree(Location location,
TreeType type)
在指定的
位置 创建一颗树. |
boolean |
generateTree(Location loc,
TreeType type,
BlockChangeDelegate delegate)
已过时。
该API很少使用,基本上是出于实现自身功能的目的而创造的
|
boolean |
getAllowAnimals()
获取动物能不能在这个世界生成。
|
boolean |
getAllowMonsters()
获取怪物能不能在这个世界生成。
|
int |
getAmbientSpawnLimit()
获取这个世界一个区块内周围的怪物的生成数限制。
|
int |
getAnimalSpawnLimit()
获取这个世界一个区块内的动物生成数限制。
|
Biome |
getBiome(int x,
int z)
获取指定方块坐标的生物群系。
|
Block |
getBlockAt(int x,
int y,
int z)
获取坐标所指的
方块 . |
Block |
getBlockAt(Location location)
|
int |
getBlockTypeIdAt(int x,
int y,
int z)
已过时。
不安全的参数
|
int |
getBlockTypeIdAt(Location location)
已过时。
不安全的参数
|
Chunk |
getChunkAt(Block block)
|
Chunk |
getChunkAt(int x,
int z)
获取给定坐标所在的
区块 . |
Chunk |
getChunkAt(Location location)
|
Difficulty |
getDifficulty()
获取世界的游戏难度。
|
ChunkSnapshot |
getEmptyChunkSnapshot(int x,
int z,
boolean includeBiome,
boolean includeBiomeTempRain)
获取空区块的快照(相当于所有空气方块),可设置包含有效生物群系数据。
|
java.util.List<Entity> |
getEntities()
获取一个这个世界所有实体的列表.
|
<T extends Entity> |
getEntitiesByClass(java.lang.Class<T>... classes)
已过时。
|
<T extends Entity> |
getEntitiesByClass(java.lang.Class<T> cls)
获取一个在这个世界的所有与指定的类/接口相匹配的实体的集合.
|
java.util.Collection<Entity> |
getEntitiesByClasses(java.lang.Class<?>... classes)
获取一个在这个世界的所有与任一指定的类/接口相匹配的实体的集合.
|
World.Environment |
getEnvironment()
获取世界的
环境 类型. |
long |
getFullTime()
获取这个世界完整的游戏时间.
|
java.lang.String[] |
getGameRules()
获取当前的游戏规则。
|
java.lang.String |
getGameRuleValue(java.lang.String rule)
获取指定游戏规则的当前状态。
|
ChunkGenerator |
getGenerator()
获取世界的区块生成器.
|
Block |
getHighestBlockAt(int x,
int z)
获取指定坐标的最顶上的方块(不是空气).
|
Block |
getHighestBlockAt(Location location)
获取指定
位置 的最顶上的方块(不是空气). |
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.
|
int |
getHighestBlockYAt(Location location)
Gets the y coordinate of the lowest block at the given
Location
such that the block and all blocks above it are transparent for lighting
purposes. |
double |
getHumidity(int x,
int z)
获取指定方块坐标的湿度。
|
boolean |
getKeepSpawnInMemory()
获取世界的出生点是否会在内存中保存加载。
|
java.util.List<LivingEntity> |
getLivingEntities()
获取一个这个世界所有生物实体的列表.
|
Chunk[] |
getLoadedChunks()
获取一个所有被加载的
区块 的数组. |
int |
getMaxHeight()
获取这个世界的最大高度。
|
int |
getMonsterSpawnLimit()
获取这个世界一个区块内的怪物生成数限制。
|
java.lang.String |
getName()
获取世界的唯一名称.
|
java.util.Collection<Entity> |
getNearbyEntities(Location location,
double x,
double y,
double z)
返回一个以这个位置为中心的包围着的所有实体的列表(译注:这个可能不太好理解,就是在这个位置,按指定的搜索范围,搜索这个范围里的所有实体).
|
java.util.List<Player> |
getPlayers()
获取一个这个世界的所有玩家的列表.
|
java.util.List<BlockPopulator> |
getPopulators()
获取一个这个世界使用的所有
方块填充器 的列表. |
boolean |
getPVP()
获取世界当前的PVP设置.
|
int |
getSeaLevel()
获取世界的海平面。
|
long |
getSeed()
获取世界的种子.
|
Location |
getSpawnLocation()
获取这个世界的默认出生点
位置 . |
double |
getTemperature(int x,
int z)
获取指定方块坐标的温度。
|
int |
getThunderDuration()
获取这个世界打雷的持续时间.
|
long |
getTicksPerAnimalSpawns()
获取世界生成动物的时间间隔(单位为tick)。
|
long |
getTicksPerMonsterSpawns()
获取世界生成怪物的时间间隔(单位为tick)。
|
long |
getTime()
获取这个世界在游戏中的相对时间.
|
java.util.UUID |
getUID()
获取世界的唯一UUID.
|
int |
getWaterAnimalSpawnLimit()
获取这个世界一个区块内的水生动物生成数限制。
|
int |
getWeatherDuration()
获取当前天气的剩余时间,单位为tick.
|
WorldBorder |
getWorldBorder()
获取这个世界的世界边界对象。
|
java.io.File |
getWorldFolder()
获取这个世界保存在磁盘的哪个文件夹。
|
WorldType |
getWorldType()
获取世界类型。
|
boolean |
hasStorm()
返回世界现在是否有雷暴.
|
boolean |
isAutoSave()
获取世界是否会自动保存。
|
boolean |
isChunkInUse(int x,
int z)
检查指定坐标的
区块 是否被加载且被一个或更多的玩家使用. |
boolean |
isChunkLoaded(Chunk chunk)
检查指定
区块 是否已经被加载. |
boolean |
isChunkLoaded(int x,
int z)
检查在指定坐标的
区块 是否被加载. |
boolean |
isGameRule(java.lang.String rule)
检查字符串是否是一个有效的游戏规则。
|
boolean |
isThundering()
返回这个世界是否在打雷.
|
void |
loadChunk(Chunk chunk)
加载指定的
区块 . |
void |
loadChunk(int x,
int z)
加载指定坐标的
区块 . |
boolean |
loadChunk(int x,
int z,
boolean generate)
加载指定坐标的
区块 . |
void |
playEffect(Location location,
Effect effect,
int data)
向以指定位置为圆心的默认半径内的所有玩家施加(给予)一个效果.
|
void |
playEffect(Location location,
Effect effect,
int data,
int radius)
向在以指定位置为圆心的指定半径内的所有玩家施加(给予)一个效果。
|
<T> void |
playEffect(Location location,
Effect effect,
T data)
向在以指定位置为圆心的默认半径内的所有玩家施加(给予)一个效果。
|
<T> void |
playEffect(Location location,
Effect effect,
T data,
int radius)
向在以指定位置为圆心的指定半径内的所有玩家施加(给予)一个效果。
|
void |
playSound(Location location,
Sound sound,
float volume,
float pitch)
在世界中指定的位置播放一个声音。
|
void |
playSound(Location location,
Sound sound,
SoundCategory category,
float volume,
float pitch)
Play a Sound at the provided Location in the World.
|
void |
playSound(Location location,
java.lang.String sound,
float volume,
float pitch)
Play a Sound at the provided Location in the World.
|
void |
playSound(Location location,
java.lang.String sound,
SoundCategory category,
float volume,
float pitch)
Play a Sound at the provided Location in the World.
|
boolean |
refreshChunk(int x,
int z)
已过时。
这个方法不能保证在所有的客户端接口都正常地工作。
|
boolean |
regenerateChunk(int x,
int z)
重新生成指定坐标的
区块 . |
void |
save()
保存世界到磁盘.
|
void |
setAmbientSpawnLimit(int limit)
设置这个世界一个区块内周围的怪物的生成数限制。
|
void |
setAnimalSpawnLimit(int limit)
设置这个世界一个区块内的动物生成数限制。
|
void |
setAutoSave(boolean value)
设置世界是否会自动保存。
|
void |
setBiome(int x,
int z,
Biome bio)
设置指定方块坐标的生物群系
原文:
Sets the biome for the given block coordinates
|
void |
setDifficulty(Difficulty difficulty)
设置世界的游戏难度。
|
void |
setFullTime(long time)
设置服务器的游戏时间.
|
boolean |
setGameRuleValue(java.lang.String rule,
java.lang.String value)
将指定的游戏规则设置为指定数值。
|
void |
setKeepSpawnInMemory(boolean keepLoaded)
设置世界的出生点是否会在内存中保存加载。
|
void |
setMonsterSpawnLimit(int limit)
设置这个世界一个区块内的怪物生成数限制。
|
void |
setPVP(boolean pvp)
设置世界的PVP设置.
|
void |
setSpawnFlags(boolean allowMonsters,
boolean allowAnimals)
为这个世界设置出生标识。
|
boolean |
setSpawnLocation(int x,
int y,
int z)
设置这个世界的出生点位置.
|
boolean |
setSpawnLocation(Location location)
设置这个世界的出生点位置.
|
void |
setStorm(boolean hasStorm)
设置是否有风暴。
|
void |
setThunderDuration(int duration)
设置这个世界打雷持续时间。
|
void |
setThundering(boolean thundering)
设置这个世界是否在打雷.
|
void |
setTicksPerAnimalSpawns(int ticksPerAnimalSpawns)
设置世界生成动物的时间间隔(单位为tick)。
|
void |
setTicksPerMonsterSpawns(int ticksPerMonsterSpawns)
设置世界生成怪物的时间间隔(单位为tick)。
|
void |
setTime(long time)
设置服务器的在游戏中的相对时间.
|
void |
setWaterAnimalSpawnLimit(int limit)
设置这个世界一个区块内的水生动物生成数限制。
|
void |
setWeatherDuration(int duration)
设置当前天气的剩余时间,单位为tick.
|
<T extends Entity> |
spawn(Location location,
java.lang.Class<T> clazz)
在指定的
位置 根据给定的类生成一个实体. |
<T extends Entity> |
spawn(Location location,
java.lang.Class<T> clazz,
Consumer<T> function)
Spawn an entity of a specific class at the given
Location , with
the supplied function run before the entity is added to the world. |
Arrow |
spawnArrow(Location location,
Vector direction,
float speed,
float spread)
|
<T extends Arrow> |
spawnArrow(Location location,
Vector direction,
float speed,
float spread,
java.lang.Class<T> clazz)
Creates an arrow entity of the given class at the given
Location |
Entity |
spawnEntity(Location loc,
EntityType type)
在指定的
位置 创建一个实体. |
FallingBlock |
spawnFallingBlock(Location location,
int blockId,
byte blockData)
已过时。
不安全的参数
|
FallingBlock |
spawnFallingBlock(Location location,
Material material,
byte data)
已过时。
不安全的参数
|
FallingBlock |
spawnFallingBlock(Location location,
MaterialData data)
|
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.
|
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.
|
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.
|
<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.
|
<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.
|
<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.
|
void |
spawnParticle(Particle particle,
Location location,
int count)
Spawns the particle (the number of times specified by count)
at the target location.
|
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.
|
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.
|
<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.
|
<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.
|
<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.
|
LightningStrike |
strikeLightning(Location loc)
在指定的
位置 劈下闪电. |
LightningStrike |
strikeLightningEffect(Location loc)
在指定的
位置 劈下不会造成伤害的闪电. |
boolean |
unloadChunk(Chunk chunk)
安全的卸载并保存指定坐标的
区块 . |
boolean |
unloadChunk(int x,
int z)
安全的卸载并保存指定坐标的
区块 . |
boolean |
unloadChunk(int x,
int z,
boolean save)
安全的卸载并选择是否保存指定坐标的
区块 . |
boolean |
unloadChunk(int x,
int z,
boolean save,
boolean safe)
已过时。
移除一个正在使用的区块从不安全
|
boolean |
unloadChunkRequest(int x,
int z)
安全地将卸载指定坐标的
区块 列入队列. |
boolean |
unloadChunkRequest(int x,
int z,
boolean safe)
将卸载指定坐标的
区块 列入队列. |
getListeningPluginChannels, sendPluginMessage
getMetadata, hasMetadata, removeMetadata, setMetadata
Block getBlockAt(int x, int y, int z)
x
- 方块的X坐标y
- 方块的Y坐标z
- 方块的Z坐标返回这个坐标所在方块的ID
Block getBlockAt(Location location)
location
- 要获取的方块的位置返回这个位置({@link Location})所在方块的ID
@Deprecated int getBlockTypeIdAt(int x, int y, int z)
原文:Gets the block type ID at the given coordinates
x
- 方块的X坐标y
- 方块的Y坐标z
- 方块的Z坐标返回这个坐标所在的方块
@Deprecated int getBlockTypeIdAt(Location location)
location
- 要获取的方块ID的位置返回一个位置({@link Location})所在的方块({@link Block})对象
int getHighestBlockYAt(int x, int z)
x
- X-coordinate of the blocksz
- Z-coordinate of the blocksint getHighestBlockYAt(Location location)
Location
such that the block and all blocks above it are transparent for lighting
purposes.location
- Location of the blocksBlock getHighestBlockAt(int x, int z)
译注:就是说,获取某个坐标最上面的方块.Essentials插件的top就是这个原理.
原文:Gets the highest non-empty block at the given coordinates
x
- X坐标z
- Z坐标Block getHighestBlockAt(Location location)
位置
的最顶上的方块(不是空气).
译注:相当于getHightestBlockYAt(location),只不过那是获得方块Y坐标,而这个是获取方块对象. 原文:Gets the highest non-empty block at the given coordinates
location
- 需要获取最高的方块的位置Chunk getChunkAt(int x, int z)
x
- X坐标z
- Z坐标boolean isChunkLoaded(Chunk chunk)
chunk
- 需要检查的区块Chunk[] getLoadedChunks()
void loadChunk(Chunk chunk)
chunk
- 待加载的区块boolean isChunkLoaded(int x, int z)
x
- 区块的x坐标z
- 区块的z坐标boolean isChunkInUse(int x, int z)
区块
是否被加载且被一个或更多的玩家使用.
原文:
Checks if the Chunk
at the specified coordinates is loaded and
in use by one or more players
x
- 区块的x坐标z
- 区块的z坐标void loadChunk(int x, int z)
区块
.
如果区块不存在则会被生成。
这个方法类似于当generate值为true时的loadChunk(int, int, boolean)
.
原文:
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.
x
- 区块的x坐标z
- 区块的z坐标boolean loadChunk(int x, int z, boolean generate)
x
- 区块的x坐标z
- 区块的z坐标generate
- 如果区块不存在是否生成boolean unloadChunk(Chunk chunk)
区块
.
这个方法类似于当safe值和saveis值为true时的unloadChunk(int, int, boolean,boolean)
原文:
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
chunk
- 卸载的区块boolean unloadChunk(int x, int z)
区块
.
这个方法类似于当safe值和saveis值为true时的unloadChunk(int, int, boolean,boolean)
原文:
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
x
- 区块的x坐标z
- 区块的z坐标boolean unloadChunk(int x, int z, boolean save)
区块
.
这个方法类似于当safe值为true时的unloadChunk(int, int, boolean,boolean)
原文:
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
x
- 区块的x坐标z
- 区块的z坐标save
- 是否保存区块@Deprecated boolean unloadChunk(int x, int z, boolean save, boolean safe)
x
- 区块的x坐标z
- 区块的z坐标save
- 控制是否保存区块safe
- 控制当附近有玩家时是否卸载区块boolean unloadChunkRequest(int x, int z)
区块
列入队列.
这个方法类似于当safe值为true时的unloadChunkRequest(int, int,boolean)
原文:
Safely queues the Chunk
at the specified coordinates for
unloading
This method is analogous to unloadChunkRequest(int, int,
boolean)
where safe is true
x
- 区块的x坐标z
- 区块的z坐标boolean unloadChunkRequest(int x, int z, boolean safe)
x
- 区块的x坐标z
- 区块的z坐标safe
- 控制当附近有玩家时是否卸载区块boolean regenerateChunk(int x, int z)
x
- 区块的x坐标z
- 区块的z坐标@Deprecated boolean refreshChunk(int x, int z)
x
- 区块的x坐标z
- 区块的z坐标Item dropItem(Location location, ItemStack item)
location
- 丢出物品的位置item
- 丢出的物品堆Item dropItemNaturally(Location location, ItemStack item)
location
- 丢出物品的位置item
- 丢出的物品堆Arrow spawnArrow(Location location, Vector direction, float speed, float spread)
location
- 生成箭的位置direction
- 箭射向的方向speed
- 箭的射速,建议为0.6spread
- 箭存在的时间(箭在多久后会消失)<T extends Arrow> T spawnArrow(Location location, Vector direction, float speed, float spread, java.lang.Class<T> clazz)
Location
T
- type of arrow to spawnlocation
- 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 arrow
SpectralArrow
,Arrow
,TippedArrow
boolean generateTree(Location location, TreeType type)
location
- 生成树的位置type
- 创建的树的类型@Deprecated boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate)
loc
- 生成树的位置type
- 创建的树的类型delegate
- 这个方法会返回一个用于调用每个方块的改变的类作为结果Entity spawnEntity(Location loc, EntityType type)
loc
- 生成实体的位置type
- 生成的实体LightningStrike strikeLightning(Location loc)
loc
- 劈下闪电的位置LightningStrike strikeLightningEffect(Location loc)
loc
- 劈下闪电的位置java.util.List<Entity> getEntities()
原文: Get a list of all entities in this World
java.util.List<LivingEntity> getLivingEntities()
原文: Get a list of all living entities in this World
@Deprecated <T extends Entity> java.util.Collection<T> getEntitiesByClass(java.lang.Class<T>... classes)
原文: Get a collection of all entities in this World matching the given class/interface
T
- 一个实体子类classes
- 用于匹配的表示实体类型的类<T extends Entity> java.util.Collection<T> getEntitiesByClass(java.lang.Class<T> cls)
原文: Get a collection of all entities in this World matching the given class/interface
T
- 一个实体子类cls
- 用于匹配的表示实体类型的类java.util.Collection<Entity> getEntitiesByClasses(java.lang.Class<?>... classes)
原文: Get a collection of all entities in this World matching any of the given classes/interfaces
classes
- 用于匹配的表示实体类型的类java.util.List<Player> getPlayers()
原文: Get a list of all players in this World
java.util.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.
location
- 搜索范围的中心x
- 搜索范围的x半轴长度y
- 搜索范围的y半轴长度z
- 搜索范围的z半轴长度java.lang.String getName()
原文: Gets the unique name of this world
java.util.UUID getUID()
原文: Gets the Unique ID of this world
Location getSpawnLocation()
boolean setSpawnLocation(Location location)
原文:Sets the spawn location of the world.
The location provided must be equal to this world.
location
- 要设置的出生点位置boolean setSpawnLocation(int x, int y, int z)
原文: Sets the spawn location of the world
x
- x坐标y
- y坐标z
- z坐标long getTime()
相对时间类似于小时数*1000(译注:意思是,如果这个世界在游戏中的时间为一个小时则相对时间显示为1000,一小时十二分为1200).
原文: Gets the relative in-game time of this world.
The relative time is analogous to hours * 1000
返回这个世界的绝对时间
void setTime(long time)
相对时间类似于小时数*1000(译注:意思是,如果这个世界在游戏中的时间为一个小时则相对时间显示为1000,一小时十二分为1200).
注意设置的相对时间如果小于当前相对时间则实际上是将时钟向前移动了一天。如果你要倒回时间,请使用setFullTime(long)
.
原文: 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)
time
- 设置的在游戏中的新的相对时间(格式为小时数*1000)设置这个世界的绝对时间
long getFullTime()
原文: Gets the full in-game time on this world
返回这个世界的相对时间
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
time
- 设置的世界的新绝对时间设置世界的相对时间
boolean hasStorm()
原文: Returns whether the world has an ongoing storm.
void setStorm(boolean hasStorm)
原文: Set whether there is a storm. A duration will be set for the new current conditions.
hasStorm
- 是否下雨或下雪int getWeatherDuration()
原文: Get the remaining time in ticks of the current conditions.
void setWeatherDuration(int duration)
原文: Set the remaining time in ticks of the current conditions.
duration
- 时间,单位为tickboolean isThundering()
原文: Returns whether there is thunder.
void setThundering(boolean thundering)
原文: Set whether it is thundering.
thundering
- 是否打雷int getThunderDuration()
原文: Get the thundering duration.
void setThunderDuration(int duration)
原文: Set the thundering duration.
duration
- 持续时间,单位为tickboolean createExplosion(double x, double y, double z, float power)
原文: Creates explosion at given coordinates with given power
x
- x坐标y
- y坐标z
- z坐标power
- 爆炸的威力,一个TNT当量为4Fboolean 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.
x
- x坐标y
- y坐标z
- z坐标power
- 爆炸的威力,一个TNT当量为4FsetFire
- 方块是否会着火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.
x
- x坐标y
- y坐标z
- z坐标power
- 爆炸的威力,一个TNT当量为4FsetFire
- 方块是否会着火breakBlocks
- 是否破坏方块boolean createExplosion(Location loc, float power)
原文: Creates explosion at given coordinates with given power
loc
- 爆炸位置power
- 爆炸的威力,一个TNT当量为4Fboolean createExplosion(Location loc, float power, boolean setFire)
原文: Creates explosion at given coordinates with given power and optionally setting blocks on fire.
loc
- 爆炸位置power
- 爆炸的威力,一个TNT当量为4FsetFire
- 方块是否会着火World.Environment getEnvironment()
环境
类型.
原文:
Gets the World.Environment
type of this world
long getSeed()
原文: Gets the Seed for this world.
boolean getPVP()
原文: Gets the current PVP setting for this world.
void setPVP(boolean pvp)
原文: Sets the PVP setting for this world.
pvp
- 是否允许PVP,允许为true,不允许为false.ChunkGenerator getGenerator()
原文: Gets the chunk generator for this world
区块生成器
void save()
原文:Saves world to disk
java.util.List<BlockPopulator> getPopulators()
方块填充器
的列表.
原文:
Gets a list of all applied BlockPopulator
s for this World
<T extends Entity> T spawn(Location location, java.lang.Class<T> clazz) throws java.lang.IllegalArgumentException
<T extends Entity> T spawn(Location location, java.lang.Class<T> clazz, Consumer<T> function) throws java.lang.IllegalArgumentException
Location
, with
the supplied function run before the entity is added to the world.
T
- the class of the Entity
to spawnlocation
- the Location
to spawn the entity atclazz
- the class of the Entity
to spawnfunction
- the function to be run before the entity is spawned.Entity
java.lang.IllegalArgumentException
- if either parameter is null or the
Entity
requested cannot be spawnedFallingBlock spawnFallingBlock(Location location, MaterialData data) throws java.lang.IllegalArgumentException
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.
location
- The Location
to spawn the FallingBlockdata
- The block dataFallingBlock
instancejava.lang.IllegalArgumentException
- if Location
or MaterialData
are null or Material
of the MaterialData
is not a block@Deprecated FallingBlock spawnFallingBlock(Location location, Material material, byte data) throws java.lang.IllegalArgumentException
位置
根据给定的物品
生成一个正在下落的方块
实体。物品决定下落的东西。当下落方块碰到地时就会放置这个方块.
物品必须是一个经过Material.isBlock()
检验的方块类型,可能不是空气.
原文:
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.
@Deprecated FallingBlock spawnFallingBlock(Location location, int blockId, byte blockData) throws java.lang.IllegalArgumentException
位置
根据指定的方块ID(会被转换为物品
)生成一个正在下落的方块
实体.
原文:
Spawn a FallingBlock
entity at the given Location
of
the specified blockId (converted to Material
)
location
- 生成下落方块的位置
blockId
- 物品相应的IDblockData
- 方块数据正在下落的方块
实例java.lang.IllegalArgumentException
- 如果位置为空或方块无效则抛出错误spawnFallingBlock(org.bukkit.Location, org.bukkit.Material, byte)
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.
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.
x
- 区块x坐标z
- 区块z坐标includeBiome
- 如果为true,则快照会包含每个坐标的生物群系类型includeBiomeTempRain
- 如果为true,则快照会包含每个坐标的原始生物群系温度和降雨void setSpawnFlags(boolean allowMonsters, boolean allowAnimals)
原文: Sets the spawn flags for this.
allowMonsters
- 如果为true,则允许怪物在这个世界生成allowAnimals
- 如果为true,则允许动物在这个世界生成boolean getAllowAnimals()
原文: Gets whether animals can spawn in this world.
boolean getAllowMonsters()
原文: Gets whether monsters can spawn in this world.
Biome getBiome(int x, int z)
原文: Gets the biome for the given block coordinates.
x
- 方块的x坐标z
- 方块的z坐标void setBiome(int x, int z, Biome bio)
原文: Sets the biome for the given block coordinates
x
- 方块的x坐标z
- 方块的z坐标bio
- 这个方块的新生物群系类型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.
x
- 方块的x坐标z
- 方块的z坐标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.
x
- 方块的x坐标z
- 方块的z坐标int getMaxHeight()
如果最大高度为100,则只有y=0到y=99才有方块。
原文: Gets the maximum height of this world.
If the max height is 100, there are only blocks from y=0 to y=99.
int getSeaLevel()
这个值总是getMaxHeight()
的一半
原文: Gets the sea level for this world.
This is often half of getMaxHeight()
boolean getKeepSpawnInMemory()
原文: Gets whether the world's spawn area should be kept loaded into memory or not.
void setKeepSpawnInMemory(boolean keepLoaded)
原文: Sets whether the world's spawn area should be kept loaded into memory or not.
keepLoaded
- 如果为true则世界的出生地区会在内存中保存加载boolean isAutoSave()
原文: Gets whether or not the world will automatically save
void setAutoSave(boolean value)
原文: Sets whether or not the world will automatically save
value
- 如果为true则世界会自动保存,否则为falsevoid setDifficulty(Difficulty difficulty)
原文: Sets the Difficulty of the world.
difficulty
- 设置的世界的新难度Difficulty getDifficulty()
原文: Gets the Difficulty of the world.
java.io.File getWorldFolder()
原文: Gets the folder of this world on disk.
WorldType getWorldType()
原文: Gets the type of this world.
boolean canGenerateStructures()
原文: Gets whether or not structures are being generated.
long getTicksPerAnimalSpawns()
这个数值决定每次尝试生成动物之间的时间间隔(单位为tick)。
用法示例:
注意:
如果设置为0,则会禁止这个世界生成动物。我们一般使用setSpawnFlags(boolean, boolean)
来代替。
Minecraft的默认值:400。
原文: 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.
void setTicksPerAnimalSpawns(int ticksPerAnimalSpawns)
这个数值决定每次尝试生成动物之间的时间间隔(单位为tick)。
用法示例:
注意:
如果设置为0,则会禁止这个世界生成动物。我们一般使用setSpawnFlags(boolean, boolean)
来代替。
Minecraft的默认值:400。
原文: 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.
ticksPerAnimalSpawns
- 设置的世界生成动物的时间间隔(单位为tick)long getTicksPerMonsterSpawns()
这个数值决定每次尝试生成怪物之间的时间间隔(单位为tick)。
用法示例:
注意:
如果设置为0,则会禁止这个世界生成怪物。我们一般使用setSpawnFlags(boolean, boolean)
来代替。
Minecraft的默认值:1。
原文: 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.
void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns)
这个数值决定每次尝试生成怪物之间的时间间隔(单位为tick)。
用法示例:
注意:
如果设置为0,则会禁止这个世界生成怪物。我们一般使用setSpawnFlags(boolean, boolean)
来代替。
Minecraft的默认值:1。
原文: 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.
ticksPerMonsterSpawns
- 设置的世界生成怪物的时间间隔(单位为tick)int getMonsterSpawnLimit()
原文: Gets limit for number of monsters that can spawn in a chunk in this world
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.
limit
- 新的怪物限制int getAnimalSpawnLimit()
原文: Gets the limit for number of animals 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
Note: If set to a negative number the world will use the server-wide spawn limit instead.
limit
- 新的动物限制int getWaterAnimalSpawnLimit()
原文: Gets the limit for number of water animals that can spawn in a chunk in this world
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.
limit
- 新的水生动物限制int getAmbientSpawnLimit()
原文: Gets the limit for number of ambient mobs that can spawn in a chunk in this world
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.
limit
- 新的周围的怪物的限制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.
location
- 演奏声音的位置sound
- 要播放的声音volume
- 声音音量pitch
- 声音音调void playSound(Location location, java.lang.String sound, float volume, float pitch)
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.
location
- the location to play the soundsound
- the internal sound name to playvolume
- the volume of the soundpitch
- the pitch of the soundvoid playSound(Location location, Sound sound, SoundCategory category, float volume, float pitch)
This function will fail silently if Location or Sound are null.
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 soundvoid playSound(Location location, java.lang.String sound, SoundCategory category, float volume, float pitch)
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.
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 soundjava.lang.String[] getGameRules()
译注:如果你不知道这是什么,请查阅gamerule命令。
原文: Get existing rules
java.lang.String getGameRuleValue(java.lang.String rule)
如果规则是空则会返回null
原文: Gets the current state of the specified rule
Will return null if rule passed is null
rule
- 要查找的规则boolean setGameRuleValue(java.lang.String rule, java.lang.String value)
规则可能会尝试验证值,如果数值被设置则会返回true。
如果规则为空,则这个函数会返回false。
原文: 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.
rule
- 要设置的规则value
- 要设置的规则数值boolean isGameRule(java.lang.String rule)
原文: Checks if string is a valid game rule
rule
- 要检测的规则WorldBorder getWorldBorder()
原文: Gets the world border for this world.
void spawnParticle(Particle particle, Location location, int count)
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesvoid spawnParticle(Particle particle, double x, double y, double z, int count)
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<T> void spawnParticle(Particle particle, Location location, int count, T data)
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 on Particle.getDataType()
<T> void spawnParticle(Particle particle, double x, double y, double z, int count, T data)
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 on Particle.getDataType()
void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ)
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 axisvoid spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ)
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<T> void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, T data)
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 on Particle.getDataType()
<T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, T data)
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 on Particle.getDataType()
void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, double extra)
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)void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra)
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)<T> void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, T data)
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 on Particle.getDataType()
<T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data)
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 on Particle.getDataType()