Enum Class GameMode

java.lang.Object
java.lang.Enum<GameMode>
fr.fidorial.entity.GameMode
All Implemented Interfaces:
Serializable, Comparable<GameMode>, Constable

public enum GameMode extends Enum<GameMode>
The vanilla game modes, with their protocol identifiers.
Since:
0.1.0
  • Enum Constant Details

    • SURVIVAL

      public static final GameMode SURVIVAL
      Players gather resources, take damage and can die.
    • CREATIVE

      public static final GameMode CREATIVE
      Players fly, are invulnerable and have unlimited blocks.
    • ADVENTURE

      public static final GameMode ADVENTURE
      Like survival, but blocks can only be broken or placed where items allow it.
    • SPECTATOR

      public static final GameMode SPECTATOR
      Players fly through blocks and cannot interact with the world.
  • Method Details

    • values

      public static GameMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static GameMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • byId

      public static @Nullable GameMode byId(int id)
      Returns the game mode with a protocol identifier, or null if there is none.
      Parameters:
      id - the protocol identifier, from 0 to 3
      Returns:
      the game mode with a protocol identifier, or null if there is none
      Since:
      0.1.0
    • byName

      public static @Nullable GameMode byName(String input)
      Parses a game mode as typed in a command.

      Accepts the English name, its French translation, the usual abbreviation (s, c, a, sp) or the protocol identifier, ignoring case.

      Parameters:
      input - the text to parse
      Returns:
      the game mode, or null if the text matches none
      Since:
      0.1.0
    • id

      public int id()
      Returns the protocol identifier of this game mode.
      Returns:
      the protocol identifier of this game mode
      Since:
      0.1.0