• Type: New Feature
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • None
    • 1.18.1
    • Yes

      You can say that there are PlayerGameModeChangeEvent... Yes, but if player joined just now, I can't get their previous game mode, but the server knows it and the game/client too (in F3+F4). I would like if method to get it would be exposed to API.

      For what I'm need it: In join event, we put player in "waiting" room and changing their game mode to adventure, then after some time player will be teleported back to the world and their game mode will be restored. The problem is just inconvenience: if player press F3+F4 once, their game mode will be changed to adventure — not "real" game mode that they was used before quit. With getting previous mode method, we can set it first and then restore player game mode, so this problem will be solved.

      Thanks!

          [SPIGOT-6899] Add Player#getPreviousGameMode()

          Zhenya Zima added a comment -

          It's saved in player.dat so it must be 

          Zhenya Zima added a comment - It's saved in player.dat so it must be 

          md_5 added a comment -

          Previous game mode isn't stored after logout though?

          md_5 added a comment - Previous game mode isn't stored after logout though?

          Zhenya Zima added a comment -

          getPreviousGameMode(), save it to variable, then (before restore)

          1. setGameMode(previous)
          2. setGameMode(real)

          So F3+F4 will again suggest previous mode, not adventure.

          Zhenya Zima added a comment - getPreviousGameMode(), save it to variable, then (before restore) setGameMode(previous) setGameMode(real) So F3+F4 will again suggest previous mode, not adventure.

          md_5 added a comment -

          I don't quite understand how having only a getter helps you?

          md_5 added a comment - I don't quite understand how having only a getter helps you?

          There is a PR open which ads this: bukkit#647 and craftbukkit#904.

          Marvin Rieple added a comment - There is a PR open which ads this: bukkit#647 and craftbukkit#904 .

            Assignee:
            Doc
            Reporter:
            Zhenya Zima
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: