Interface PlayerSettings


public interface PlayerSettings
Represents the settings/preferences of a connected player.

These settings are extracted from the player's Connect packet when they join the proxy.

Example Usage

PlayerSettings settings = player.getPlayerSettings();

// Get the player's locale
Locale locale = settings.getLocale();
String message = getLocalizedMessage("welcome", locale);

// Or with Optional
settings.getLocaleCode().ifPresent(code -> {
    // Use the raw locale code (e.g., "en-US", "de-DE")
});
See Also:
  • Method Details

    • getLocale

      @Nonnull Locale getLocale()
      Gets the player's locale/language preference.

      This is parsed from the language field in the Connect packet. If no language was provided or parsing fails, returns the default locale.

      Returns:
      the player's locale, or Locale.ENGLISH if unknown
    • getLocaleCode

      @Nonnull Optional<String> getLocaleCode()
      Gets the raw locale code as sent by the client.

      This is the unprocessed language string from the Connect packet, which may be in formats like "en-US", "de-DE", "fr", etc.

      Returns:
      the raw locale code, or empty if not provided
    • getClientType

      @Nonnull PlayerSettings.ClientType getClientType()
      Gets the client type the player is using.

      This indicates whether the client is the main game client, an editor, or another client type.

      Returns:
      the client type