Package org.bukkit
Interface WorldBorder
public interface WorldBorder
- 
Method SummaryModifier and TypeMethodDescriptionGets the current border center.doubleGets the current border damage amount.doubleGets the current border damage buffer.doubleGets the absolute value of the maximum x/z center coordinate of a WorldBorder.doubleGets the maximum possible size of a WorldBorder.doublegetSize()Gets the current side length of the border.intGets the current border warning distance.intGets the current border warning time in seconds.getWorld()Get theWorldin which the border resides.default booleanisInBounds(@NotNull Location location) Deprecated, for removal: This API element is subject to removal in a future version.booleanCheck if the specified location is inside this border.voidreset()Resets the border to default values.voidsetCenter(double x, double z) Sets the new border center.voidSets the new border center.voidsetDamageAmount(double damage) Sets the amount of damage a player takes when outside the border plus the border buffer.voidsetDamageBuffer(double blocks) Sets the amount of blocks a player may safely be outside the border before taking damage.voidsetSize(double newSize) Sets the border to a square region with the specified side length in blocks.voidsetSize(double newSize, long seconds) Sets the border to a square region with the specified side length in blocks.voidSets the border to a square region with the specified side length in blocks.voidsetWarningDistance(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.voidsetWarningTime(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.
- 
Method Details- 
getWorldGet theWorldin which the border resides.- Returns:
- the associated world, or null if this world border is not associated
 with any specific world, such as those created via Server.createWorldBorder()
 
- 
resetvoid reset()Resets the border to default values.
- 
getSizedouble getSize()Gets the current side length of the border.- Returns:
- The current side length of the border.
 
- 
setSizevoid setSize(double newSize) Sets the border to a square region with the specified side length in blocks.- Parameters:
- newSize- The new size of the border.
- Throws:
- IllegalArgumentException- if newSize is less than 1.0D or greater than- getMaxSize()
 
- 
setSizevoid setSize(double newSize, long seconds) Sets the border to a square region with the specified side length in blocks.- Parameters:
- newSize- The new side length of the border.
- seconds- The time in seconds in which the border grows or shrinks from the previous size to that being set.
- Throws:
- IllegalArgumentException- if newSize is less than 1.0D or greater than- getMaxSize()
 
- 
setSizeSets the border to a square region with the specified side length in blocks.- Parameters:
- 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.
- Throws:
- IllegalArgumentException- if unit is- nullor newSize is less than 1.0D or greater than- getMaxSize()
 
- 
getCenterGets the current border center.- Returns:
- The current border center.
 
- 
setCentervoid setCenter(double x, double z) Sets the new border center.- Parameters:
- x- The new center x-coordinate.
- z- The new center z-coordinate.
- Throws:
- IllegalArgumentException- if the absolute value of x or z is higher than- getMaxCenterCoordinate()
 
- 
setCenterSets the new border center.- Parameters:
- location- The new location of the border center. (Only x/z used)
- Throws:
- IllegalArgumentException- if location is- nullor the absolute value of- Location.getX()or- Location.getZ()is higher than- getMaxCenterCoordinate()
 
- 
getDamageBufferdouble getDamageBuffer()Gets the current border damage buffer.- Returns:
- The current border damage buffer.
 
- 
setDamageBuffervoid setDamageBuffer(double blocks) Sets the amount of blocks a player may safely be outside the border before taking damage.- Parameters:
- blocks- The amount of blocks. (The default is 5 blocks.)
 
- 
getDamageAmountdouble getDamageAmount()Gets the current border damage amount.- Returns:
- The current border damage amount.
 
- 
setDamageAmountvoid setDamageAmount(double damage) Sets the amount of damage a player takes when outside the border plus the border buffer.- Parameters:
- damage- The amount of damage. (The default is 0.2 damage per second per block.)
 
- 
getWarningTimeint getWarningTime()Gets the current border warning time in seconds.- Returns:
- The current border warning time in seconds.
 
- 
setWarningTimevoid 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.- Parameters:
- seconds- The amount of time in seconds. (The default is 15 seconds.)
 
- 
getWarningDistanceint getWarningDistance()Gets the current border warning distance.- Returns:
- The current border warning distance.
 
- 
setWarningDistancevoid 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.- Parameters:
- distance- The distance in blocks. (The default is 5 blocks.)
 
- 
isInsideCheck if the specified location is inside this border.- Parameters:
- location- the location to check
- Returns:
- if this location is inside the border or not
 
- 
getMaxSizedouble getMaxSize()Gets the maximum possible size of a WorldBorder.- Returns:
- The maximum size the WorldBorder
 
- 
getMaxCenterCoordinatedouble getMaxCenterCoordinate()Gets the absolute value of the maximum x/z center coordinate of a WorldBorder.- Returns:
- The absolute maximum center coordinate of the WorldBorder
 
- 
isInBounds@Deprecated(forRemoval=true) @ScheduledForRemoval(inVersion="1.21") default boolean isInBounds(@NotNull @NotNull Location location) Deprecated, for removal: This API element is subject to removal in a future version.useisInside(Location)for an upstream compatible replacementChecks if the location is within the boundaries of this border.- Parameters:
- location- specific location to check
- Returns:
- true if the location is within the bounds of this border, false otherwise.
 
 
- 
isInside(Location)for an upstream compatible replacement