Class TeleportUtil

java.lang.Object
net.lewmc.essence.utils.TeleportUtil

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

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Used to communicate the type of teleportation to commands where this may be ambiguous.
  • 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)
    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.
    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.
    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

    • TeleportUtil

      public TeleportUtil(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)
      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)
      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

      public TeleportUtil.Type getTeleportType(String[] args)
      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.
    • 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.