Interface DocumentView


public interface DocumentView
An active view of a document that's been spawned in the world.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    cancelTask(int taskId)
    Cancel a scheduled task.
    void
    Closes this view
    org.joml.Vector2f
    Gets the position of the player's cursor in screen coordinates.
    org.joml.Vector3f
    Gets the position of the player's cursor along the screen in world coordinates.
    Gets the document that belongs to this view
    Get the instance name of this view.
    Gets the path of the opened document
    Gets the players this view belongs to
    Gets the resources of this view
    Gets the screen that this view is rendered with
    @NotNull org.bukkit.util.Transformation
    Get the current screen transformation.
    org.bukkit.World
    Gets the world the view is spawned in.
    boolean
    Test if the view is closed
    boolean
    Tests if this view is currently being looked at by the player.
    void
    moveTo(@NotNull org.bukkit.Location location)
    Moves the page to the specified location.
    void
    moveTo(@NotNull org.bukkit.Location location, boolean changeRotation)
    Moves the page to the specified location.
    void
    moveTo(@NotNull org.bukkit.World world, @NotNull org.joml.Vector3f position)
    Moves the page to the specified position in the specified world.
    void
    moveTo(@NotNull org.joml.Vector3f position)
    Moves the page to the specified position.
    int
    runLater(long tickDelay, @NotNull Runnable task)
    Execute a task after a tick delay.
    int
    runRepeating(long tickDelay, long tickInterval, @NotNull Runnable task)
    Execute a task repeatedly
    void
    setScreenTransform(@NotNull org.bukkit.util.Transformation transformation)
    Set the current screen transformation.
    void
    transform(@NotNull org.bukkit.util.Transformation transformation)
    Apply a transformation to the view's screen.
  • Method Details

    • getDocument

      Document getDocument()
      Gets the document that belongs to this view
      Returns:
      View document
    • getScreen

      Screen getScreen()
      Gets the screen that this view is rendered with
      Returns:
      View Screen
    • getInstanceName

      String getInstanceName()
      Get the instance name of this view.

      Instance names are unique names given to each page used to differentiate them from other open pages of the same module or same resource path.

      Returns:
      Instance name
    • getCursorScreenPosition

      org.joml.Vector2f getCursorScreenPosition()
      Gets the position of the player's cursor in screen coordinates.
      Returns:
      Cursor screen position, or null, if the player is not looking at the screen
    • getCursorWorldPosition

      org.joml.Vector3f getCursorWorldPosition()
      Gets the position of the player's cursor along the screen in world coordinates.
      Returns:
      Cursor world position, or null, if the player is not looking at the screen
    • getPath

      ResourcePath getPath()
      Gets the path of the opened document
      Returns:
      Document path
    • getResources

      ViewResources getResources()
      Gets the resources of this view
      Returns:
      View resources
    • getPlayers

      PlayerSet getPlayers()
      Gets the players this view belongs to
      Returns:
      View players
    • getWorld

      org.bukkit.World getWorld()
      Gets the world the view is spawned in.
      Returns:
      View world.
    • close

      void close()
      Closes this view
    • isClosed

      boolean isClosed()
      Test if the view is closed
      Returns:
      true, if the view has been closed, false if it's open.
    • isSelected

      boolean isSelected()
      Tests if this view is currently being looked at by the player.
      Returns:
      true, if
      invalid reference
      #getPlayer()
      is currently looking at the view, false otherwise.
    • transform

      void transform(@NotNull @NotNull org.bukkit.util.Transformation transformation)
      Apply a transformation to the view's screen.
      Parameters:
      transformation - Transformation to apply to the screen
      Throws:
      NullPointerException - If transformation is null
    • setScreenTransform

      void setScreenTransform(@NotNull @NotNull org.bukkit.util.Transformation transformation)
      Set the current screen transformation.

      The translation component of the specified transformation becomes the position of the center of the screen

      Parameters:
      transformation - New screen Transformation
      Throws:
      NullPointerException - If transformation is null
    • getScreenTransform

      @NotNull @NotNull org.bukkit.util.Transformation getScreenTransform()
      Get the current screen transformation.

      The returned transformation's translation component will be the screen center's position

      Returns:
      View screen's transformation
    • moveTo

      void moveTo(@NotNull @NotNull org.bukkit.Location location)
      Moves the page to the specified location.

      The view will be moved so the bottom middle is at the location. The specified location's yaw and pitch become the screen's rotation.

      Parameters:
      location - New location
      Throws:
      NullPointerException - If location is null
    • moveTo

      void moveTo(@NotNull @NotNull org.bukkit.Location location, boolean changeRotation)
      Moves the page to the specified location.

      The view ill be moved so the bottom middle is at the specified location.

      If #changeRotation is set to true, the specified location's yaw and pitch will become the screen's rotation.

      Parameters:
      location - New location
      changeRotation - true, to change the screen's rotation, false otherwise
      Throws:
      NullPointerException - If location is null
    • moveTo

      void moveTo(@NotNull @NotNull org.bukkit.World world, @NotNull @NotNull org.joml.Vector3f position)
      Moves the page to the specified position in the specified world.

      The view will be moved so the bottom middle is at the specified position

      Parameters:
      world - New world
      position - New position
      Throws:
      NullPointerException - If world or position is null
    • moveTo

      void moveTo(@NotNull @NotNull org.joml.Vector3f position)
      Moves the page to the specified position.

      The view will be moved so the bottom middle is at the specified position

      Parameters:
      position - New position
      Throws:
      NullPointerException - If position is null
    • runLater

      int runLater(long tickDelay, @NotNull @NotNull Runnable task) throws IllegalArgumentException
      Execute a task after a tick delay.

      Tasks scheduled with DocumentView's schedulers are only active while the view itself is active. Once closed, all tasks are cancelled.

      Parameters:
      tickDelay - Tick Delay
      task - Task
      Returns:
      Task ID
      Throws:
      IllegalArgumentException - If tickDelay is less than 1
      NullPointerException - If task is null
      See Also:
    • runRepeating

      int runRepeating(long tickDelay, long tickInterval, @NotNull @NotNull Runnable task) throws NullPointerException
      Execute a task repeatedly

      Tasks scheduled with DocumentView's schedulers are only active while the view itself is active. Once closed, all tasks are cancelled.

      Parameters:
      tickDelay - Initial Tick Delay
      tickInterval - Delay between task repetitions
      task - Task
      Returns:
      Task ID
      Throws:
      NullPointerException - If task is null
      IllegalArgumentException - If tickInterval is less than 1
      See Also:
    • cancelTask

      boolean cancelTask(int taskId)
      Cancel a scheduled task.
      Parameters:
      taskId - Task ID
      Returns:
      true, if the task was cancelled, false, if it was already cancelled or had finished execution.
      See Also: