API interface for interacting with EssentialsC's spawn system. Manages the server
spawn location, teleportation with warmup and cooldown, and first-join spawning.
All location data is persisted to spawn.yml.
Retrieve an instance via EssentialsCAPI.getSpawnApi().
SpawnApi spawn = APIProvider.getAPI().getSpawnApi();
if (spawn.isSpawnSet()) {
spawn.teleportToSpawn(player);
}
Method Summary
| boolean |
isSpawnSet() Returns whether a spawn location has been set. |
| Location |
getSpawn() Returns the current spawn location. |
| void |
setSpawn(Location location) Sets the spawn location to the given location. |
| boolean |
isOnCooldown(Player player) Returns whether the given player is currently on spawn cooldown. |
| long |
getRemainingCooldown(Player player) Returns the remaining cooldown time in seconds for the given player. |
| boolean |
hasPendingTeleport(Player player) Returns whether the given player has a pending spawn teleport warmup. |
| void |
teleportToSpawn(Player player) Initiates teleportation to spawn for the given player. |
| void |
teleportToSpawnImmediate(Player player) Immediately teleports the given player to spawn, bypassing warmup. |
| void |
cancelTeleport(Player player) Cancels any pending spawn teleport for the given player. |
| void |
reload() Reloads the spawn configuration from disk. |
Returns whether a spawn location has been set.
Returns:| boolean | true if spawn is configured and world is loaded |
Returns the current spawn location.
Returns:| Location | a copy of the spawn location, or null if not set |
Sets the spawn location to the given location. Persists immediately to spawn.yml. Overwrites any existing spawn.
| location | the location to set as spawn; must not be null |
Returns whether the given player is currently on spawn cooldown.
Players with the essentialsc.spawn.admin permission bypass cooldowns.
| player | the player to check; must not be null |
| boolean | true if the player must wait before using spawn again |
Returns the remaining cooldown time in seconds for the given player.
Returns 0 if the player is not on cooldown or has bypass permission.
| player | the player to check; must not be null |
| long | remaining cooldown in seconds, or 0 |
Returns whether the given player has a pending spawn teleport warmup.
Parameters:| player | the player to check; must not be null |
| boolean | true if a warmup is in progress |
Initiates teleportation to spawn for the given player. Applies warmup and cooldown checks. Sends appropriate messages to the player. If warmup is configured, the teleport will occur after the delay unless cancelled.
| player | the player to teleport; must not be null |
Immediately teleports the given player to spawn, bypassing warmup. Cooldown is still applied unless the player has bypass permission.
| player | the player to teleport; must not be null |
Cancels any pending spawn teleport for the given player. Has no effect if the player has no pending teleport.
| player | the player whose teleport to cancel; must not be null |
Reloads the spawn configuration from disk. Re-reads spawn.yml and updates the cached spawn location.