Enum Class GameMode

java.lang.Object
java.lang.Enum<GameMode>
fr.hytale.loader.api.GameMode
All Implemented Interfaces:
Serializable, Comparable<GameMode>, Constable

public enum GameMode extends Enum<GameMode>
Represents the game mode of a player.

This enum provides a simplified wrapper around Hytale's native GameMode class, making it easier to work with game modes without directly depending on the native API.

Since:
1.0.2
Version:
1.0.4
Author:
HytaleLoader
  • Enum Constant Details

    • CREATIVE

      public static final GameMode CREATIVE
      Creative mode - players have unlimited resources and cannot take damage.
    • ADVENTURE

      public static final GameMode ADVENTURE
      Adventure mode - default mode for players, similar to survival from Minecraft
  • 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
    • getId

      public int getId()
      Gets the numeric ID of this game mode.
      Returns:
      the game mode ID
    • toNative

      public com.hypixel.hytale.protocol.GameMode toNative()
      Converts this HytaleLoader GameMode to the native Hytale GameMode.
      Returns:
      the native Hytale GameMode instance
    • fromNative

      public static GameMode fromNative(com.hypixel.hytale.protocol.GameMode nativeGameMode)
      Converts a native Hytale GameMode to a HytaleLoader GameMode.
      Parameters:
      nativeGameMode - the native Hytale game mode
      Returns:
      the HytaleLoader GameMode, or SURVIVAL if null or unknown
    • fromId

      public static GameMode fromId(int id)
      Gets a GameMode by its numeric ID.
      Parameters:
      id - the game mode ID
      Returns:
      the GameMode, or SURVIVAL if the ID is invalid