Skip to content

Player abilities are reset when teleport across dimensions #12361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
NonSwag opened this issue Mar 29, 2025 · 0 comments
Open

Player abilities are reset when teleport across dimensions #12361

NonSwag opened this issue Mar 29, 2025 · 0 comments
Labels

Comments

@NonSwag
Copy link
Contributor

NonSwag commented Mar 29, 2025

Expected behavior

Abilities shouldn't change
If the player is in survival or adventure mode and are able to fly, that behavior should persist across dimension teleports

Observed/Actual behavior

When teleporting across dimensions, the abilities are reevaluated

For reference

  • CraftPlayer#teleport calls PlayerList#respawn L1511
  • PlayerList#respawn calls PlayerList#restoreFrom L2052
  • PlayerList#restoreFrom calls ServerPlayerGameMode#setGameModeForPlayer L93

Steps/models to reproduce

  1. Set the player's game mode to survival or adventure
  2. Allow the player to fly (Player#setAllowFlight)
  3. Teleport the player into a different dimension via Player#teleportAsync important
  4. Player is not able to fly anymore

Plugin and Datapack List

plugins: Tweaks
datapacks: [vanilla (built-in)], [file/bukkit (world)], [paper (built-in)]

Paper version

This server is running Paper version 1.21.4-222-main@9b1798d (2025-03-27T13:35:40Z) (Implementing API version 1.21.4-R0.1-SNAPSHOT)

Other

This is a problem because the PlayerChangedWorldEvent is called after the player is respawned, meaning you may receive a wrong value when checking the player's ability to fly

In my specific case, I persist the player's flight state and ability to fly on dimension change to be able to restore those values later when the player enters that specific world again
(basically per world fly state)

@papermc-sniffer papermc-sniffer bot added the version: 1.21.4 Game version 1.21.4 label Mar 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant