Feathers are now safely deducted when activating FeatherFly or switching between worlds as intended.
Improvements:
Task Management:
Ensured that feather drain tasks are properly canceled before starting new ones, preventing multiple tasks from running simultaneously and causing excessive feather draining.
I've been having an issue on my server where some players have their feathers draining faster than others, I haven't been able to pinpoint the problem yet. If you guys find an instance where you're losing feathers, please let me know.
Resolved an issue where the default flight speed wasn't being applied when players joined the server with FeatherFly already enabled. The flight speed is now correctly applied after re-logging, world changes, and when toggling FeatherFly.
Enforced the default flight speed by adding checks during player movement (PlayerMoveEvent) and world changes (PlayerChangedWorldEvent), ensuring players cannot bypass the configured flight speed.
Flight Speed Application on Join:
Added a slight delay after players join the server to ensure that the flight state is fully restored before applying the default flight speed. This prevents players from bypassing the flight speed until FeatherFly is re-enabled.
World Change Speed Enforcement:
Ensured that the flight speed is correctly applied after players switch between worlds, maintaining the configured speed without allowing players to bypass it.
General Enhancements:
Additional Flight Speed Checks:
Regularly enforced the default flight speed while the player is flying through event checks, such as player movement and world changes, ensuring the speed remains consistent at all times.
Separation of FeatherFly from Creative/Spectator Fly:
FeatherFly is now disabled when switching to Creative or Spectator mode, but the native fly provided by these game modes remains unaffected. Players will still be able to fly natively in these modes without needing FeatherFly.
Improvements:
Game Mode Change Detection:
When players switch to Creative or Spectator mode, FeatherFly is automatically disabled to avoid conflicts, while ensuring native flight remains enabled.
Added handling for PlayerGameModeChangeEvent to monitor game mode changes and ensure FeatherFly only operates in Survival and Adventure modes.
Bug Fixes:
Flight Speed Consistency:
Ensured that flight speed is correctly restored after reconnecting, switching worlds, or re-enabling FeatherFly. This prevents cases where flight speed was not correctly applied.
Persistent Flight State: Players' flight states are now saved in playerdata.yml, allowing their feather-based flight status to persist across disconnects and server restarts.
Flight Restoration on Login: When players reconnect, their flight state is restored automatically, preventing them from falling upon re-entry.
Compatibility:
Fully tested and compatible with Minecraft version 1.21.1
Minimum Drain Mechanism: Introduced a "Minimum Drain" feature that sets the minimum number of feathers to be drained when a player activates the flight command. This prevents players from abusing quick flights by ensuring that at least a set minimum number of feathers are consumed.
Bug Fixes:
Feather Drain While Not Flying: Fixed a bug where feathers were being drained even when the player was not actively flying. This has been addressed by adding a check to only drain feathers when the player is actually flying or hasn't reached the minimum drain amount.