Package net.lewmc.essence.utils
Class TeleportUtil
java.lang.Object
net.lewmc.essence.utils.TeleportUtil
Essence's teleportation utility.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Used to communicate the type of teleportation to commands where this may be ambiguous. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
cooldownRemaining
(org.bukkit.entity.Player player, String type) Gets the amount of time remaining on a specific type of cooldown.boolean
cooldownSurpassed
(org.bukkit.entity.Player player, String type) Checks if the cooldown has surpassed for a specific type of teleportation.void
doTeleport
(org.bukkit.entity.Player player, org.bukkit.Location location, int delay) Teleports a player.void
doTeleport
(org.bukkit.entity.Player player, org.bukkit.World world, double X, double Y, double Z, float yaw, float pitch, int delay) Creates a location to teleport a player, then teleports them.getTeleportType
(String[] args) Determines which type of teleportation is taking place.void
setCooldown
(org.bukkit.entity.Player player, String type) Sets the cooldown for a specific type of teleportation.void
setTeleportStatus
(org.bukkit.entity.Player player, boolean teleportInFuture) Sets a player's teleport status.boolean
teleportIsValid
(org.bukkit.entity.Player player) Gets a player's teleport status.
-
Constructor Details
-
TeleportUtil
Constructor for the TeleportUtil class.- Parameters:
plugin
- Reference to the main Essence class.
-
-
Method Details
-
cooldownSurpassed
Checks if the cooldown has surpassed for a specific type of teleportation.- Parameters:
player
- Player - The player to querytype
- String - The type of teleportation.- Returns:
- boolean - If the cooldown has surpassed or not.
-
setCooldown
Sets the cooldown for a specific type of teleportation.- Parameters:
player
- Player - The player to set the cooldown for.type
- String - The type of cooldown.
-
cooldownRemaining
Gets the amount of time remaining on a specific type of cooldown.- Parameters:
player
- Player - The player to set the cooldown for.type
- String - The type of cooldown.- Returns:
- int - The amount of time remaining.
-
doTeleport
public void doTeleport(org.bukkit.entity.Player player, org.bukkit.World world, double X, double Y, double Z, float yaw, float pitch, int delay) Creates a location to teleport a player, then teleports them.- Parameters:
player
- Player - The player to teleport.world
- World - The world to teleport them to.X
- double - The X coordinate.Y
- double - The Y coordinate.Z
- double - The Z coordinate.yaw
- float - The yaw.pitch
- float - The pitchdelay
- int - The time to wait before teleporting.
-
doTeleport
public void doTeleport(org.bukkit.entity.Player player, org.bukkit.Location location, int delay) Teleports a player.- Parameters:
player
- Player - The player to teleport.location
- Location - The location to teleport them to,delay
- int - The amount of time to wait before teleporting.
-
getTeleportType
Determines which type of teleportation is taking place.- Parameters:
args
- String[] - arguments from a command.- Returns:
- Type - The teleportation type (instanceof TeleportUtil.Type)
-
setTeleportStatus
public void setTeleportStatus(org.bukkit.entity.Player player, boolean teleportInFuture) Sets a player's teleport status.- Parameters:
player
- Player - The player to teleport.teleportInFuture
- boolean - Is the teleport happening in the future?
-
teleportIsValid
public boolean teleportIsValid(org.bukkit.entity.Player player) Gets a player's teleport status.- Parameters:
player
- Player - The player to teleport.
-