Interface Ride
public interface Ride
Represents a single Ride
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
addPlayer
(org.bukkit.entity.Player player) Add a new player to the ride, putting them in the first available seat Ride price, permissions will be checkedboolean
addPlayer
(org.bukkit.entity.Player player, boolean bypassCost, int seatNumber, RideEnterEvent.EnterMethod enterMethod) Add a new player to the ride Adds to the ride queue if the ride is full (still returns true)default boolean
addPlayer
(org.bukkit.entity.Player player, boolean bypassCost, RideEnterEvent.EnterMethod enterMethod) Add a new player to the ride, putting them in the first available seatvoid
disable()
Disable the ridevoid
ejectPlayer
(org.bukkit.entity.Player player, RideExitEvent.ExitReason reason) Remove a player from the ride (forcefully) Uses the ride's EXIT_TELEPORT_RUNNING option to determine whether to teleport or eject the player at their seatboolean
enable()
Enable the rideint
Finds the first available seat on the ridegetName()
int
List<org.bukkit.entity.Player>
int
getRiderSeat
(org.bukkit.entity.Player player) Find which seat a rider is in Will throw an IllegalArgumentException if player is not on ridegetRideSetting
(String key) Get the value of a ride settinggetType()
boolean
boolean
boolean
void
setRideSetting
(String key, Object value) Set a ride's settingvoid
startRide
(RideStartEvent.StartReason startReason) Starts the movement of a ridevoid
stopRide
(RideStopEvent.RideStopReason stopReason) Stop a ride (immediately), and kicks players out
-
Method Details
-
getName
String getName()- Returns:
- this ride's Name / ID
-
getType
String getType()- Returns:
- a string representing the ride type
-
getRiders
List<org.bukkit.entity.Player> getRiders()- Returns:
- an ArrayList containing the players currently on the ride.
-
getRiderSeat
int getRiderSeat(org.bukkit.entity.Player player) Find which seat a rider is in Will throw an IllegalArgumentException if player is not on ride- Parameters:
player
- the player whose seat you want to find- Returns:
- the index of the seat (counts from 0)
-
getConfigOptions
- Returns:
- an ArrayList containing the names of all ride settings
-
getConfigOptionTypes
- Returns:
- a map containing all ride settings and their type
-
getRideSetting
Get the value of a ride setting- Parameters:
key
- the name of the setting- Returns:
- the current value of the setting
-
setRideSetting
Set a ride's setting- Parameters:
key
- the name of the settingvalue
- the new value for the setting- Throws:
IllegalArgumentException
- if value is not correct type for given keyIndexOutOfBoundsException
- if the key does not exist
-
enable
boolean enable()Enable the ride- Returns:
- true if enabled successfully, false if encountered an issue.
-
disable
void disable()Disable the ride -
startRide
Starts the movement of a ride -
stopRide
Stop a ride (immediately), and kicks players out -
firstAvailableSeat
int firstAvailableSeat()Finds the first available seat on the ride- Returns:
- the index of the seat, -1 if the ride is full
-
addPlayer
boolean addPlayer(org.bukkit.entity.Player player, boolean bypassCost, int seatNumber, RideEnterEvent.EnterMethod enterMethod) Add a new player to the ride Adds to the ride queue if the ride is full (still returns true)- Parameters:
player
- the player to addbypassCost
- whether to ignore the priceseatNumber
- the seat index to add the player trueenterMethod
- the method used to join the ride- Returns:
- true if successful, false if failed (i.e. seat taken, not enough money, no permissions)
-
addPlayer
default boolean addPlayer(org.bukkit.entity.Player player, boolean bypassCost, RideEnterEvent.EnterMethod enterMethod) Add a new player to the ride, putting them in the first available seat- Parameters:
player
- the player to addbypassCost
- whether to ignore the price- Returns:
- true if successful, false if failed
-
addPlayer
default boolean addPlayer(org.bukkit.entity.Player player) Add a new player to the ride, putting them in the first available seat Ride price, permissions will be checked- Parameters:
player
- the player to add- Returns:
- true if successful, false if failed
-
ejectPlayer
Remove a player from the ride (forcefully) Uses the ride's EXIT_TELEPORT_RUNNING option to determine whether to teleport or eject the player at their seat- Parameters:
player
- the player to ejectreason
- the reason for exiting (ie. Command / Ride end etc)
-
isEnabled
boolean isEnabled()- Returns:
- whether this ride is currently enabled.
-
isRunning
boolean isRunning()- Returns:
- whether the ride is currently running (i.e. moving)
-
isCountdownStarted
boolean isCountdownStarted()- Returns:
- whether the ride's countdown (for automatically starting) has begun
-
getRemainingCountdownTime
int getRemainingCountdownTime()- Returns:
- how long is left on the ride's countdown timer. -1 if countdown hasn't started
-