Class UtilTeleport

java.lang.Object
net.lewmc.essence.teleportation.tp.UtilTeleport

public class UtilTeleport extends Object
Essence's teleportation utility.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Used to communicate the direction of a safe location search.
    static final record 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for the TeleportUtil class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    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, boolean doLastLocUpdate)
    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, boolean doLastLocUpdate)
    Creates a location to teleport a player, then teleports them.
    static org.bukkit.Location
    findFurthestLocation(org.bukkit.Location origin, UtilTeleport.Direction direction, org.bukkit.entity.Player player)
    Finds a safe location relative to the origin point.
    findLevelLocation(org.bukkit.Location origin, UtilTeleport.Direction direction, Integer levels, org.bukkit.entity.Player player)
    Finds a safe location to teleport a player to, given a direction and number of levels.
    void
    sendToSpawn(org.bukkit.entity.Player player, String spawnName)
    Sends a player back to spawn.
    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.
    boolean
    teleportToggleCheck(org.bukkit.entity.Player requester, org.bukkit.entity.Player target)
    Is the teleport blocked by the teleport toggle?

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • UtilTeleport

      public UtilTeleport(Essence plugin)
      Constructor for the TeleportUtil class.
      Parameters:
      plugin - Reference to the main Essence class.
  • Method Details

    • cooldownSurpassed

      public boolean cooldownSurpassed(org.bukkit.entity.Player player, String type)
      Checks if the cooldown has surpassed for a specific type of teleportation.
      Parameters:
      player - Player - The player to query
      type - String - The type of teleportation.
      Returns:
      boolean - If the cooldown has surpassed or not.
    • setCooldown

      public void setCooldown(org.bukkit.entity.Player player, String type)
      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

      public int cooldownRemaining(org.bukkit.entity.Player player, String type)
      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, boolean doLastLocUpdate)
      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 pitch
      delay - int - The time to wait before teleporting.
    • doTeleport

      public void doTeleport(org.bukkit.entity.Player player, org.bukkit.Location location, int delay, boolean doLastLocUpdate)
      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.
    • 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.
      Returns:
      boolean - Is valid?
    • teleportToggleCheck

      public boolean teleportToggleCheck(org.bukkit.entity.Player requester, org.bukkit.entity.Player target)
      Is the teleport blocked by the teleport toggle?
      Parameters:
      requester - The player requesting the teleport.
      target - The target of the teleport.
      Returns:
      true - Teleport can proceed, false - Teleport should be blocked.
    • findFurthestLocation

      public static org.bukkit.Location findFurthestLocation(org.bukkit.Location origin, UtilTeleport.Direction direction, org.bukkit.entity.Player player)
      Finds a safe location relative to the origin point.
      Parameters:
      origin - The starting location.
      direction - The direction to search.
      Returns:
      A safe location, or null if none found.
    • findLevelLocation

      public static UtilTeleport.LevelLocation findLevelLocation(org.bukkit.Location origin, UtilTeleport.Direction direction, Integer levels, org.bukkit.entity.Player player)
      Finds a safe location to teleport a player to, given a direction and number of levels.
      Parameters:
      origin - The location to start searching from.
      direction - The direction to search in.
      levels - The number of levels to search.
      player - The player to check for safe locations.
      Returns:
      A LevelLocation containing the safe location and the number of levels searched, or null if no safe location is found.
    • sendToSpawn

      public void sendToSpawn(org.bukkit.entity.Player player, String spawnName)
      Sends a player back to spawn.
      Parameters:
      player - Player - The player.
      spawnName - String - the spawn's name