Package org.bukkit

Enum Class GameMode

All Implemented Interfaces:
Serializable, Comparable<GameMode>, Constable, Translatable

public enum GameMode extends Enum<GameMode> implements Translatable
Represents the various type of game modes that HumanEntitys may have
  • Enum Constant Details


      public static final GameMode CREATIVE
      Creative mode may fly, build instantly, become invulnerable and create free items.

      public static final GameMode SURVIVAL
      Survival mode is the "normal" gameplay type, with no special features.

      public static final GameMode ADVENTURE
      Adventure mode cannot break blocks without the correct tools.

      public static final GameMode SPECTATOR
      Spectator mode cannot interact with the world in anyway and is invisible to normal players. This grants the player the ability to no-clip through 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.
      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.)
      name - the name of the enum constant to be returned.
      the enum constant with the specified name
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • translationKey

      @NotNull public @NotNull String translationKey()
      Description copied from interface: net.kyori.adventure.translation.Translatable
      Gets the translation key.
      Specified by:
      translationKey in interface Translatable
      the translation key
    • getValue

      @Internal public int getValue()
      Gets the mode value associated with this GameMode
      An integer value of this gamemode
      API Note:
      Internal Use Only
    • getByValue

      @Internal @Nullable public static @Nullable GameMode getByValue(int value)
      Gets the GameMode represented by the specified value
      value - Value to check
      Associative GameMode with the given value, or null if it doesn't exist
      API Note:
      Internal Use Only