Interface DocumentView
-
Method Summary
Modifier and TypeMethodDescriptionboolean
cancelTask
(int taskId) Cancel a scheduled task.void
close()
Closes this vieworg.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 viewGet the instance name of this view.getPath()
Gets the path of the opened documentGets the players this view belongs toGets the resources of this viewGets the screen that this view is rendered with@NotNull org.bukkit.util.Transformation
Get the current screen transformation.org.bukkit.World
getWorld()
Gets the world the view is spawned in.boolean
isClosed()
Test if the view is closedboolean
Tests if this view is currently being looked at by the player.void
moveTo
(@NotNull org.bukkit.Location location) Moves the page to the specifiedlocation
.void
moveTo
(@NotNull org.bukkit.Location location, boolean changeRotation) Moves the page to the specifiedlocation
.void
moveTo
(@NotNull org.bukkit.World world, @NotNull org.joml.Vector3f position) Moves the page to the specifiedposition
in the specifiedworld
.void
moveTo
(@NotNull org.joml.Vector3f position) Moves the page to the specifiedposition
.int
Execute a task after a tick delay.int
runRepeating
(long tickDelay, long tickInterval, @NotNull Runnable task) Execute a task repeatedlyvoid
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
-
getScreen
-
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
-
getResources
-
getPlayers
-
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
, ifinvalid reference
#getPlayer()
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
- Iftransformation
isnull
-
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
- Iftransformation
isnull
-
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 specifiedlocation
.The view will be moved so the bottom middle is at the
location
. The specifiedlocation
's yaw and pitch become the screen's rotation.- Parameters:
location
- New location- Throws:
NullPointerException
- Iflocation
isnull
-
moveTo
void moveTo(@NotNull @NotNull org.bukkit.Location location, boolean changeRotation) Moves the page to the specifiedlocation
.The view ill be moved so the bottom middle is at the specified
location
.If
#changeRotation
is set totrue
, the specifiedlocation
's yaw and pitch will become the screen's rotation.- Parameters:
location
- New locationchangeRotation
-true
, to change the screen's rotation,false
otherwise- Throws:
NullPointerException
- Iflocation
isnull
-
moveTo
void moveTo(@NotNull @NotNull org.bukkit.World world, @NotNull @NotNull org.joml.Vector3f position) Moves the page to the specifiedposition
in the specifiedworld
.The view will be moved so the bottom middle is at the specified
position
- Parameters:
world
- New worldposition
- New position- Throws:
NullPointerException
- Ifworld
orposition
isnull
-
moveTo
void moveTo(@NotNull @NotNull org.joml.Vector3f position) Moves the page to the specifiedposition
.The view will be moved so the bottom middle is at the specified
position
- Parameters:
position
- New position- Throws:
NullPointerException
- Ifposition
isnull
-
runLater
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 Delaytask
- Task- Returns:
- Task ID
- Throws:
IllegalArgumentException
- IftickDelay
is less than1
NullPointerException
- Iftask
isnull
- See Also:
-
runRepeating
int runRepeating(long tickDelay, long tickInterval, @NotNull @NotNull Runnable task) throws NullPointerException Execute a task repeatedlyTasks scheduled with DocumentView's schedulers are only active while the view itself is active. Once closed, all tasks are cancelled.
- Parameters:
tickDelay
- Initial Tick DelaytickInterval
- Delay between task repetitionstask
- Task- Returns:
- Task ID
- Throws:
NullPointerException
- Iftask
isnull
IllegalArgumentException
- IftickInterval
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:
-