Overview | EssentialsC | TpaApi
net.godlycow.org.essc.api

Interface TpaApi

public interface TpaApi

API interface for interacting with EssentialsC's TPA (teleport request) system. Manages teleport requests between players with cooldowns, warmup, economy costs, and safety checks (movement, damage). Supports both TPA and TPAHere request types.

Retrieve an instance via EssentialsCAPI.getTpaApi().

TpaApi tpa = APIProvider.getAPI().getTpaApi();

tpa.requestTeleport(requester, target, TPARequestEntry.Type.TPA);

The TPARequestEntry record lives in the net.godlycow.org.essc.api.teleport sub-package.

Method Summary

boolean requestTeleport(Player requester, Player target, TPARequestEntry.Type type)
Sends a teleport request from one player to another.
boolean acceptRequest(Player target, Player requester)
Accepts a pending teleport request from the requester to the target.
boolean denyRequest(Player target, Player requester)
Denies a pending teleport request from the requester to the target.
boolean cancelRequest(Player requester, Player target)
Cancels an outgoing teleport request from the requester to the target.
void toggleTPA(Player player)
Toggles TPA requests on/off for the given player.
void toggleIgnore(Player player, Player target)
Toggles ignore status for a specific player.
List<TPARequestEntry> getIncomingRequests(Player player)
Returns all incoming TPA requests for the given player.
List<TPARequestEntry> getOutgoingRequests(Player player)
Returns all outgoing TPA requests for the given player.
boolean hasIncomingRequests(Player player)
Returns whether the player has any pending incoming requests.
boolean hasOutgoingRequests(Player player)
Returns whether the player has any pending outgoing requests.
boolean isBlocking(Player player)
Returns whether the player has TPA requests blocked.
void cancelTeleport(Player player, String reason)
Cancels an active teleport warmup for the given player.
boolean isInTeleport(Player player)
Returns whether the player is currently in teleport warmup.
void reload()
Reloads the TPA configuration from disk.
Method Detail
public boolean requestTeleport(Player requester, Player target, TPARequestEntry.Type type)

Sends a teleport request from one player to another. Validates cooldowns, blocked status, ignores, and economy funds. Sends appropriate messages to both players on success or failure.

Warning: Must be called on the main thread.
Parameters:
requesterthe player sending the request; must not be null
targetthe player receiving the request; must not be null
typethe type of request (TPA or TPAHERE); must not be null
Returns:
booleantrue if the request was sent successfully
public boolean acceptRequest(Player target, Player requester)

Accepts a pending teleport request from the requester to the target. Initiates the teleport warmup and deducts economy cost if configured.

Warning: Must be called on the main thread.
Parameters:
targetthe player accepting the request; must not be null
requesterthe player who sent the request; must not be null
Returns:
booleantrue if a valid request was found and accepted
public boolean denyRequest(Player target, Player requester)

Denies a pending teleport request from the requester to the target. Notifies both players of the denial.

Warning: Must be called on the main thread.
Parameters:
targetthe player denying the request; must not be null
requesterthe player who sent the request; must not be null
Returns:
booleantrue if a valid request was found and denied
public boolean cancelRequest(Player requester, Player target)

Cancels an outgoing teleport request from the requester to the target. Notifies the requester of the cancellation.

Warning: Must be called on the main thread.
Parameters:
requesterthe player cancelling their request; must not be null
targetthe target player of the request; must not be null
Returns:
booleantrue if a valid outgoing request was found and cancelled
public void toggleTPA(Player player)

Toggles TPA requests on/off for the given player. When disabled, other players cannot send TPA requests to this player.

Warning: Must be called on the main thread.
Parameters:
playerthe player to toggle; must not be null
public void toggleIgnore(Player player, Player target)

Toggles ignore status for a specific player. When ignoring a player, their TPA requests will be silently rejected.

Warning: Must be called on the main thread.
Parameters:
playerthe player toggling ignore; must not be null
targetthe player to ignore/unignore; must not be null
public List<TPARequestEntry> getIncomingRequests(Player player)

Returns all incoming TPA requests for the given player. Automatically cleans up expired requests before returning.

Parameters:
playerthe player to check; must not be null
Returns:
List<TPARequestEntry>an unmodifiable list of incoming requests; never null
public List<TPARequestEntry> getOutgoingRequests(Player player)

Returns all outgoing TPA requests for the given player. Automatically cleans up expired requests before returning.

Parameters:
playerthe player to check; must not be null
Returns:
List<TPARequestEntry>an unmodifiable list of outgoing requests; never null
public boolean hasIncomingRequests(Player player)

Returns whether the player has any pending incoming requests.

Parameters:
playerthe player to check; must not be null
Returns:
booleantrue if there are pending incoming requests
public boolean hasOutgoingRequests(Player player)

Returns whether the player has any pending outgoing requests.

Parameters:
playerthe player to check; must not be null
Returns:
booleantrue if there are pending outgoing requests
public boolean isBlocking(Player player)

Returns whether the player has TPA requests blocked.

Parameters:
playerthe player to check; must not be null
Returns:
booleantrue if the player is blocking TPA requests
public void cancelTeleport(Player player, String reason)

Cancels an active teleport warmup for the given player. Called automatically on movement, damage, or disconnect.

Warning: Must be called on the main thread.
Parameters:
playerthe player whose teleport to cancel; must not be null
reasonthe cancellation reason key (e.g., "move", "damage")
public boolean isInTeleport(Player player)

Returns whether the player is currently in teleport warmup.

Parameters:
playerthe player to check; must not be null
Returns:
booleantrue if a teleport is in progress
public void reload()

Reloads the TPA configuration from disk. Re-reads cooldown, warmup, timeout, and cost settings from config.

Warning: Must be called on the main thread.