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

Interface RtpApi

public interface RtpApi

API interface for interacting with EssentialsC's Random Teleport (RTP) system. Allows external plugins to query RTP state, trigger teleports, and inspect per-world configuration without direct dependency on internal classes.

Retrieve an instance via EssentialsCAPI.getRtpApi().

RtpApi rtp = APIProvider.getAPI().getRtpApi();

if (!rtp.isOnCooldown(player)) {
    World world = Bukkit.getWorld("world");
    rtp.startRTP(player, world);
}

All methods are synchronous and safe to call on the main thread. The startRTP method must be called on the main thread.

Method Summary

boolean isEnabled()
Returns whether the RTP system is enabled globally in config.
boolean isWorldEnabled(String worldName)
Returns whether RTP is enabled for the given world name.
boolean isOnCooldown(Player player)
Returns whether the given player is currently on RTP cooldown.
long getRemainingCooldown(Player player)
Returns the remaining cooldown time in seconds for the given player.
boolean isRtpInProgress(Player player)
Returns whether a random teleport is currently in progress for the player.
boolean hasWorldPermission(Player player, String worldName)
Returns whether the given player has permission to use RTP in the specified world.
List<String> getConfiguredWorldNames()
Returns the list of world names that are configured for RTP and currently loaded.
int getPlayerCountInWorld(String worldName)
Returns the number of players currently in the given world.
void startRTP(Player player, World world)
Initiates a random teleport for the given player in the specified world.
Method Detail
public boolean isEnabled()

Returns whether the RTP system is enabled globally in config.

Returns:
booleantrue if RTP is enabled
public boolean isWorldEnabled(String worldName)

Returns whether RTP is enabled for the given world name.

Parameters:
worldNamethe world to check; must not be null
Returns:
booleantrue if RTP is enabled for that world
public boolean isOnCooldown(Player player)

Returns whether the given player is currently on RTP cooldown.

Players with the essentialsc.rtp.bypass.cooldown permission are never considered on cooldown.

Parameters:
playerthe player to check; must not be null
Returns:
booleantrue if the player must wait before using RTP again
public long getRemainingCooldown(Player player)

Returns the remaining cooldown time in seconds for the given player.

Returns 0 if the player is not on cooldown or has bypass permission.

Parameters:
playerthe player to check; must not be null
Returns:
longremaining cooldown in seconds, or 0
public boolean isRtpInProgress(Player player)

Returns whether a random teleport is currently in progress for the given player (i.e. they are in warmup or location-search phase).

Parameters:
playerthe player to check; must not be null
Returns:
booleantrue if an RTP is already running for this player
public boolean hasWorldPermission(Player player, String worldName)

Returns whether the given player has permission to use RTP in the specified world.

Parameters:
playerthe player to check; must not be null
worldNamethe world name; must not be null
Returns:
booleantrue if the player has the required world permission
public List<String> getConfiguredWorldNames()

Returns the list of world names that are configured for RTP and currently loaded.

Returns:
List<String>an unmodifiable sorted list of world names; never null
public int getPlayerCountInWorld(String worldName)

Returns the number of players currently in the given world.

Parameters:
worldNamethe world to query; must not be null
Returns:
intthe player count, or 0 if the world is not loaded
public void startRTP(Player player, World world)

Initiates a random teleport for the given player in the specified world.

Performs all standard checks (permission, cooldown, world enabled, in-progress) and sends the appropriate lang messages. Warmup is applied unless the player has bypass permission.

Warning: Must be called on the main thread.
Parameters:
playerthe online player to teleport; must not be null
worldthe world to teleport into; must not be null