Package com.melluh.servertours.api
Interface TouringPlayer
public interface TouringPlayer
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canExit()
Checks whether the player is currently allowed to exit.void
exit()
Stops playback of the tour for the player.Gets the route point the player is currently viewing.org.bukkit.Location
Gets where the player will be teleported to when they finish the tour.org.bukkit.entity.Player
Gets the Bukkit player instance.float
Gets the progress this player has made over the current point.getRoute()
Gets the route this player is viewing.float
Gets the progress this player has made over the whole tour.boolean
Checks whether the action bar message is enabled.boolean
Checks whether the player can exit by moving.boolean
Checks whether the progress bar is enabled.boolean
Checks whether this player is waiting for confirmation to continue.void
setActionBarEnabled
(boolean actionBarEnabled) Sets whether the action bar is enabled.void
setCanExit
(boolean canExit) Sets whether the player should be allowed to exit.void
setCurrentPoint
(int index) Changes the point the player is currently viewing.void
setCurrentPoint
(RoutePoint point) Changes the point the player is currently viewing.void
setExitByMoving
(boolean exitByMoving) Sets whether the player is able to exit by moving.void
setExitLocation
(org.bukkit.Location exitLocation) Sets wherer the player will be teleported when they finish the tour.void
setProgressBarEnabled
(boolean progressBarEnabled) Sets whether the progress bar is enabled.void
setWaitingForConfirmation
(boolean waitingForConfirmation) Sets whether this player is waiting for confirmation to continue.
-
Method Details
-
exit
void exit()Stops playback of the tour for the player. ARoutePlaybackEndEvent
will be fired withRoutePlaybackEndEvent.EndReason.API
. -
getRouteProgress
float getRouteProgress()Gets the progress this player has made over the whole tour.- Returns:
- the progress, in the range 0.0-1.0
-
getPointProgress
float getPointProgress()Gets the progress this player has made over the current point.- Returns:
- the progress, in the range 0.0-1.0
-
setCurrentPoint
void setCurrentPoint(int index) Changes the point the player is currently viewing. By modifying this, the player will start back at the beginning of that route point. If applicable, the point title and description will also be sent and any applicable point commands will be run.- Parameters:
index
- the point index
-
setCurrentPoint
Changes the point the player is currently viewing. By modifying this, the player will start back at the beginning of that route point. If applicable, the point title and description will also be sent and any applicable point commands will be run.- Parameters:
point
- the point
-
getCurrentPoint
RoutePoint getCurrentPoint()Gets the route point the player is currently viewing.- Returns:
- the point
-
getRoute
Route getRoute()Gets the route this player is viewing.- Returns:
- the route
-
getPlayer
org.bukkit.entity.Player getPlayer()Gets the Bukkit player instance.- Returns:
- the bukkit player
-
isWaitingForConfirmation
boolean isWaitingForConfirmation()Checks whether this player is waiting for confirmation to continue. If this is the case, the player will have been prompted to press their mouse, press a key, or click a button in chat, depending on the point's settings.- Returns:
true
if waiting for confirmation
-
setWaitingForConfirmation
void setWaitingForConfirmation(boolean waitingForConfirmation) Sets whether this player is waiting for confirmation to continue. When you set this totrue
, playback will be paused and the player will be prompted to perform an action, depending on the current point's settings. If setting tofalse
instead, playback will be resumed if it was paused.- Parameters:
waitingForConfirmation
- whether to wait for confirmation
-
isProgressBarEnabled
boolean isProgressBarEnabled()Checks whether the progress bar is enabled. The progress bar shows the player how far along the tour route they are, by using the XP bar.- Returns:
true
if the progress bar is enabled
-
setProgressBarEnabled
void setProgressBarEnabled(boolean progressBarEnabled) Sets whether the progress bar is enabled. The progress bar shows the player how far along the tour route they are, by using the XP bar.- Parameters:
progressBarEnabled
- whether the progress should be enabled
-
isActionBarEnabled
boolean isActionBarEnabled()Checks whether the action bar message is enabled. This shows the player a constant action bar configured in the language config while they are viewing a tour route.- Returns:
true
if the action bar is enabled
-
setActionBarEnabled
void setActionBarEnabled(boolean actionBarEnabled) Sets whether the action bar is enabled. When enabled, this shows the player a constant action bar configured in the language config while they are viewing a tour route.- Parameters:
actionBarEnabled
- whether the action bar should be enabled
-
canExit
boolean canExit()Checks whether the player is currently allowed to exit. The player can only exit the tour themselves (by pressing SHIFT) if this is enabled.- Returns:
true
if the player is allowed to exit
-
setCanExit
void setCanExit(boolean canExit) Sets whether the player should be allowed to exit. The player can only exit the tour themselves (by pressing SHIFT) if this is enabled.- Parameters:
canExit
- whether the player is allowed to exit the tour
-
isExitByMoving
boolean isExitByMoving()Checks whether the player can exit by moving. If enabled, the player can exit the tour by pressing the WASD keys, in addition to being able to exit by pressing SHIFT.- Returns:
true
if this is enabled
-
setExitByMoving
void setExitByMoving(boolean exitByMoving) Sets whether the player is able to exit by moving. If enabled, the player can exit the tour by pressing the WASD keys, in addition to being able to exit by pressing SHIFT.- Parameters:
exitByMoving
- whether the player can exit by moving
-
getExitLocation
org.bukkit.Location getExitLocation()Gets where the player will be teleported to when they finish the tour. By default, this is the location they entered the tour from.- Returns:
- the exit location
-
setExitLocation
void setExitLocation(org.bukkit.Location exitLocation) Sets wherer the player will be teleported when they finish the tour.- Parameters:
exitLocation
- the new exit location
-