接口 WorldBorder
-
方法概要
修饰符和类型方法说明得到当前边界的中心.double获取越过结界后所受到的伤害值double得到当前边界的破坏缓冲.doubleGets the absolute value of the maximum x/z center coordinate of a WorldBorder.doubleGets the maximum possible size of a WorldBorder.doublegetSize()获得指定世界当前的边界长度.int获取玩家离方块多远时会被警告int获取临近结界的时候屏幕变红警告玩家的时间getWorld()Get theWorldin which the border resides.boolean检查指定的位置是否在这个边界里面.voidreset()将世界的边界恢复为默认值.voidsetCenter(double x, double z) 设置新的边界中心.void设置新的边界中心voidsetDamageAmount(double damage) 设置越界后所受到的伤害值voidsetDamageBuffer(double blocks) 设置玩家在越过结界后几个方块后受到伤害(也就是玩家越界后安全的范围),切忌填写负数参数voidsetSize(double newSize) 以方块为单位,将边界设置为一个指定长度的正方形.voidsetSize(double newSize, long seconds) 以方块为单位,将边界设置为一个指定长度的正方形.voidSets the border to a square region with the specified side length in blocks.voidsetWarningDistance(int distance) 设置玩家离结界几个方块的时候会被警告voidsetWarningTime(int seconds) 设置玩家接近结界的时候警告玩家的秒数(警告也就是当玩家接近结界的时候,玩家的屏幕会被渲染成红色边框以此来警告玩家不要越界)
-
方法详细资料
-
getWorld
Get theWorldin which the border resides.- 返回:
- the associated world, or null if this world border is not associated
with any specific world, such as those created via
Server.createWorldBorder()
-
reset
void reset()将世界的边界恢复为默认值.原文:Resets the border to default values.
-
getSize
double getSize()获得指定世界当前的边界长度.原文:Gets the current side length of the border.
- 返回:
- 世界的当前边界长度.
-
setSize
void setSize(double newSize) 以方块为单位,将边界设置为一个指定长度的正方形.原文:Sets the border to a square region with the specified side length in blocks.
- 参数:
newSize- 边界的新长度.- 抛出:
IllegalArgumentException- if newSize is less than 1.0D or greater thangetMaxSize()
-
setSize
void setSize(double newSize, long seconds) 以方块为单位,将边界设置为一个指定长度的正方形.原文:Sets the border to a square region with the specified side length in blocks.
- 参数:
newSize- 边界的新长度.seconds- The time in seconds in which the border grows or shrinks from the previous size to that being set.- 抛出:
IllegalArgumentException- if newSize is less than 1.0D or greater thangetMaxSize()
-
setSize
Sets the border to a square region with the specified side length in blocks.- 参数:
newSize- The new side length of the border.unit- The time unit.time- The time in which the border grows or shrinks from the previous size to that being set.- 抛出:
IllegalArgumentException- if unit isnullor newSize is less than 1.0D or greater thangetMaxSize()
-
getCenter
得到当前边界的中心.原文:Gets the current border center.
- 返回:
- 当前边界的中心.
-
setCenter
void setCenter(double x, double z) 设置新的边界中心.原文:Sets the new border center.
- 参数:
x- 新中心的x坐标.z- 新中心的z坐标.- 抛出:
IllegalArgumentException- if the absolute value of x or z is higher thangetMaxCenterCoordinate()
-
setCenter
设置新的边界中心原文:Sets the new border center.
- 参数:
location- 边界新中心的位置. (该位置只包含x z)- 抛出:
IllegalArgumentException- if location isnullor the absolute value ofLocation.getX()orLocation.getZ()is higher thangetMaxCenterCoordinate()
-
getDamageBuffer
double getDamageBuffer()得到当前边界的破坏缓冲.原文:Gets the current border damage buffer.
- 返回:
- 当前边界的破坏缓存.
-
setDamageBuffer
void setDamageBuffer(double blocks) 设置玩家在越过结界后几个方块后受到伤害(也就是玩家越界后安全的范围),切忌填写负数参数原文:Sets the amount of blocks a player may safely be outside the border before taking damage.
- 参数:
blocks- 越过结界的缓冲方块数量,如果不设置的话默认是5个方块
-
getDamageAmount
double getDamageAmount()获取越过结界后所受到的伤害值原文:Gets the current border damage amount.
- 返回:
- 返回越界后受到的伤害值.
-
setDamageAmount
void setDamageAmount(double damage) 设置越界后所受到的伤害值原文:Sets the amount of damage a player takes when outside the border plus the border buffer.
- 参数:
damage- 要设置的伤害值,默认的是超过一个方块一秒受到0.2伤害
-
getWarningTime
int getWarningTime()获取临近结界的时候屏幕变红警告玩家的时间原文:Gets the current border warning time in seconds.
- 返回:
- 接近结界的时候警告玩家的秒数.
-
setWarningTime
void setWarningTime(int seconds) 设置玩家接近结界的时候警告玩家的秒数(警告也就是当玩家接近结界的时候,玩家的屏幕会被渲染成红色边框以此来警告玩家不要越界)原文:Sets the warning time that causes the screen to be tinted red when a contracting border will reach the player within the specified time.
- 参数:
seconds- 警告玩家的秒数,默认是15秒钟
-
getWarningDistance
int getWarningDistance()获取玩家离方块多远时会被警告原文:Gets the current border warning distance.
- 返回:
- 离结界多少方块的时候会被警告
-
setWarningDistance
void setWarningDistance(int distance) 设置玩家离结界几个方块的时候会被警告原文:Sets the warning distance that causes the screen to be tinted red when the player is within the specified number of blocks from the border.
- 参数:
distance- 要设置玩家会被警告的距离
-
isInside
检查指定的位置是否在这个边界里面.原文:Check if the specified location is inside this border.
- 参数:
location- 要检查的位置- 返回:
- 指定的位置是否在这个边界里面
-
getMaxSize
double getMaxSize()Gets the maximum possible size of a WorldBorder.- 返回:
- The maximum size the WorldBorder
-
getMaxCenterCoordinate
double getMaxCenterCoordinate()Gets the absolute value of the maximum x/z center coordinate of a WorldBorder.- 返回:
- The absolute maximum center coordinate of the WorldBorder
-