Skip to content

PersistFly

Keeps a player's flight turned on when they change worlds or dimensions, respawn, or log back in. For ops it also keeps their gamemode.

What it does

  • Saves each player's flight state (allowed to fly, and flying right now) and gamemode.
  • Puts that state back a few ticks after the player joins, changes world, or respawns. This beats the server or other plugins that reset flight on those events.
  • Restores flight for everyone with persistfly.fly (all players by default).
  • Restores gamemode only for players with persistfly.gamemode (ops by default).
  • Skips flight restore in worlds listed in disabled-worlds.

It does not give flight. Something else (for example EssentialsX /fly) must turn it on first.

How players use it

Players do not run any commands. If you can fly, turn it on once (for example with /fly) and start flying. After that your flight stays on when you go to the nether, die and respawn, or log out and back in.

Staff guide

Task Command Permission
Reload config.yml /persistfly reload persistfly.reload (op)

Recipes:

  • Stop flight being kept in one world: add the world name to disabled-worlds, then /persistfly reload. Overworld is world, nether DIM-1, End DIM1.
  • Stop one player's flight being kept: negate persistfly.fly for them in LuckPerms.
  • Let a non-op keep their gamemode too: grant persistfly.gamemode.

Test as a non-op, because ops also get gamemode restores.

Configuration

File: plugins/PersistFly/config.yml. /persistfly reload applies changes. No restart needed.

Key Default What it is for
persist-fly true Save and restore flight
persist-gamemode true Save and restore gamemode (only for persistfly.gamemode holders)
restore-delay-ticks 3 Wait this many ticks (1 tick = 50 ms) before restoring. Raise it if another plugin keeps winning
disabled-worlds [] Worlds where flight is not restored

Note: a world in disabled-worlds only means PersistFly will not turn flight back on there. It does not take flight away. Use a world or region flag if you need to block flying.

Data and storage

plugins/PersistFly/playerdata.yml, one entry per player UUID:

<uuid>:
  allowFlight: true
  flying: false
  gamemode: SURVIVAL

The plugin holds this data in memory and writes the whole file when any player quits and when the server stops. So edit or delete the file only while the server is stopped; edits made while it runs are overwritten. Deleting a player's block (or the whole file) is safe; they just start fresh.

Troubleshooting

Symptom Cause Fix
Flight is lost after a world change Another plugin resets it later than PersistFly restores Raise restore-delay-ticks (try 10) and reload
A player still flies after their fly rank ended PersistFly restores saved flight for anyone with persistfly.fly, which everyone has Negate persistfly.fly for them, or remove their block from playerdata.yml while the server is stopped
Flight just turned on with /fly is turned off again after a world change The new state is saved only when the player actually starts or stops flying, or quits. Until then, the older saved state is restored Have the player fly once after /fly, or relog
An op is put back into an old gamemode after a world change Same cause: /gamemode changes are saved only on a flight toggle or quit Toggle flight once, or relog, after changing gamemode
Could not save playerdata.yml Disk or permission problem Check the plugin folder is writable

A good boot logs:

[PersistFly] PersistFly enabled ... fly and gamemode states will persist.

Maintainer notes

  • Saves happen on PlayerToggleFlightEvent (one tick later), on quit, and on shutdown. There is no save on /fly or /gamemode, which is why the two "turned off again" rows above happen.
  • Restores run on join, world change, and respawn, all at MONITOR priority plus the delay.
  • On main, EssentialsX essentials.fly is enough for flight to persist, because persistfly.fly defaults to everyone.
  • Runs on main and build.

Building

./gradlew build

Java 21, Spigot API 1.21.1. Output: build/libs/PersistFly-1.0.0.jar. Ignore bin/, which is IDE output. A new jar needs a server restart.

Full command, permission and config tables: Reference.