Class PlayerEvent.PlayerChangeGameModeEvent

All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent
Enclosing class:
PlayerEvent

public static class PlayerEvent.PlayerChangeGameModeEvent extends PlayerEvent implements net.neoforged.bus.api.ICancellableEvent
Fired when the game type of a server player is changed to a different value than what it was previously. Eg Creative to Survival, not Survival to Survival. If the event is cancelled the game mode of the player is not changed and the value of newGameMode is ignored.
  • Field Details

    • currentGameMode

      private final GameType currentGameMode
    • newGameMode

      private GameType newGameMode
  • Constructor Details

    • PlayerChangeGameModeEvent

      public PlayerChangeGameModeEvent(Player player, GameType currentGameMode, GameType newGameMode)
  • Method Details

    • getCurrentGameMode

      public GameType getCurrentGameMode()
    • getNewGameMode

      public GameType getNewGameMode()
    • setNewGameMode

      public void setNewGameMode(GameType newGameMode)
      Sets the game mode the player will be changed to if this event is not cancelled.