Package org.bukkit

Interface WorldBorder


public interface WorldBorder
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the current border center.
    double
    Gets the current border damage amount.
    double
    Gets the current border damage buffer.
    double
    Gets the current side length of the border.
    int
    Gets the current border warning distance.
    int
    Gets the current border warning time in seconds.
    default boolean
    Deprecated.
    use isInside(Location) for an upstream compatible replacement
    boolean
    isInside​(@NotNull Location location)
    Check if the specified location is inside this border.
    void
    Resets the border to default values.
    void
    setCenter​(double x, double z)
    Sets the new border center.
    void
    Sets the new border center.
    void
    setDamageAmount​(double damage)
    Sets the amount of damage a player takes when outside the border plus the border buffer.
    void
    setDamageBuffer​(double blocks)
    Sets the amount of blocks a player may safely be outside the border before taking damage.
    void
    setSize​(double newSize)
    Sets the border to a square region with the specified side length in blocks.
    void
    setSize​(double newSize, long seconds)
    Sets the border to a square region with the specified side length in blocks.
    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.
    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.
  • Method Details

    • reset

      void reset()
      Resets the border to default values.
    • getSize

      double getSize()
      Gets the current side length of the border.
      Returns:
      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.
      Parameters:
      newSize - The new size of the border.
    • setSize

      void 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.
    • getCenter

      Gets the current border center.
      Returns:
      The current border center.
    • setCenter

      void setCenter(double x, double z)
      Sets the new border center.
      Parameters:
      x - The new center x-coordinate.
      z - The new center z-coordinate.
    • setCenter

      void setCenter(@NotNull @NotNull Location location)
      Sets the new border center.
      Parameters:
      location - The new location of the border center. (Only x/z used)
    • getDamageBuffer

      double getDamageBuffer()
      Gets the current border damage buffer.
      Returns:
      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.
      Parameters:
      blocks - The amount of blocks. (The default is 5 blocks.)
    • getDamageAmount

      double getDamageAmount()
      Gets the current border damage amount.
      Returns:
      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.
      Parameters:
      damage - The amount of damage. (The default is 0.2 damage per second per block.)
    • getWarningTime

      int getWarningTime()
      Gets the current border warning time in seconds.
      Returns:
      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.
      Parameters:
      seconds - The amount of time in seconds. (The default is 15 seconds.)
    • getWarningDistance

      int getWarningDistance()
      Gets the current border warning distance.
      Returns:
      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.
      Parameters:
      distance - The distance in blocks. (The default is 5 blocks.)
    • isInside

      boolean isInside(@NotNull @NotNull Location location)
      Check if the specified location is inside this border.
      Parameters:
      location - the location to check
      Returns:
      if this location is inside the border or not
    • isInBounds

      @Deprecated default boolean isInBounds(@NotNull @NotNull Location location)
      Deprecated.
      use isInside(Location) for an upstream compatible replacement
      Checks 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.