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

Interface FlyApi

public interface FlyApi

API interface for interacting with EssentialsC's fly system. EssentialsC persists fly state across sessions — players who were flying when they disconnected will have flight restored on their next join, unless they hold the essentialsc.fly.disable-on-join permission.

Retrieve an instance via EssentialsCAPI.getFlyApi().

FlyApi fly = APIProvider.getAPI().getFlyApi();

if (!fly.isFlying(player)) {
    fly.setFlying(player, true);
}

Method Summary

boolean isFlying(Player player)
Returns whether the given player currently has flight enabled.
boolean hasPersistentFly(UUID uuid)
Returns whether the given player is flagged to have fly restored on next join.
Set<UUID> getPersistentFlyPlayers()
Returns a snapshot of all UUIDs queued for fly restoration on next join.
void setFlying(Player player, boolean flying)
Enables or disables flight for the given player.
void toggleFlying(Player player)
Toggles flight for the given player.
void setPersistentFly(UUID uuid, boolean persistent)
Sets whether the given player's fly state will be restored on their next join.
Method Detail
public boolean isFlying(Player player)

Returns whether the given player currently has flight enabled.

This checks both allowFlight and the active flying state on the player, so it returns true only when the player can and is actively flying.

Parameters:
playerthe player to check; must not be null
Returns:
booleantrue if the player is currently flying
public boolean hasPersistentFly(UUID uuid)

Returns whether the given player is flagged to have their fly state restored on their next join.

Players are added to this set when they disconnect while flying. The flag is cleared once they reconnect and flight is restored.

Parameters:
uuidthe UUID of the player; must not be null
Returns:
booleantrue if flight will be restored for this player on next join
public Set<UUID> getPersistentFlyPlayers()

Returns a snapshot of the UUIDs of all players whose fly state is queued for restoration on next join.

The returned set is not backed by the internal state — modifications have no effect.

Returns:
Set<UUID>an unmodifiable set of UUIDs; never null, may be empty
public void setFlying(Player player, boolean flying)

Enables or disables flight for the given player.

When enabling, both allowFlight and the active fly state are set. When disabling, both are cleared. This does not affect the persistent fly flag — use setPersistentFly(UUID, boolean) if you also want to control session restoration.

Parameters:
playerthe player to modify; must not be null and must be online
flyingtrue to enable flight, false to disable it
public void toggleFlying(Player player)

Toggles flight for the given player.

Equivalent to setFlying(player, !isFlying(player)).

Parameters:
playerthe player to toggle; must not be null and must be online
public void setPersistentFly(UUID uuid, boolean persistent)

Sets whether the given player's fly state will be restored on their next join.

Set to true to add the player to the persistence set, false to remove them. Changes are written to disk immediately.

Parameters:
uuidthe UUID of the player; must not be null
persistenttrue to persist fly across the next session, false to clear the flag