afk manager api

Control the AFK teleportation system.


Package

bg.pikz.shards.api.interfaces.AFKManagerAPI

Accessing AFKManagerAPI

import bg.pikz.shards.api.ShardsAPIProvider;
import bg.pikz.shards.api.interfaces.AFKManagerAPI;

ShardsAPI api = ShardsAPIProvider.getAPI();
AFKManagerAPI afkManager = api.getAfkManager();

Methods

setAFKLocation(Location location)

Sets the AFK teleport location.

void setAFKLocation(Location location)

Parameters:

  • location - The location to set as AFK destination

Example:


teleportToAFK(Player player)

Teleports a player to the AFK location with countdown.

Parameters:

  • player - The player to teleport

Example:


cancelAFKTeleport(Player player)

Cancels an ongoing AFK teleport for a player.

Parameters:

  • player - The player whose teleport to cancel

Example:


hasMovedSignificantly(Player player)

Checks if a player has moved significantly from their starting position.

Parameters:

  • player - The player to check

Returns: true if the player has moved significantly

Example:


Complete Example


Movement Detection Example