public static PlayerRegisterResponse registerPlayer(
Client client,
String name,
Object playerData
) throws IOException
Registers a new player with optional custom data. Uses generic type for player data with Jackson serialization.
public static PlayerRegisterResponse registerPlayerWithSteam(
Client client,
String steamTicket,
String steamIdentity,
String name,
Object playerData,
String playerToken,
boolean restore
) throws IOException
Registers or logs in a player via a hex-encoded Steam auth ticket from ISteamUser::GetAuthTicketForWebApi (single-use — request a fresh ticket each login). Requires Steam enabled for the project in the API cabinet; the account persists via SteamID. A ticket-only overload registerPlayerWithSteam(client, steamTicket) fills the rest with defaults. Response includes steam_id via getSteamId().
Ticket minting is out of scope for this SDK (server/tooling use): Java clients can mint via a Steamworks binding such as steamworks4j — SteamUser.getAuthTicketForWebApi(identity).
public static PlayerRegisterResponse registerPlayerWithGoogle(
Client client,
String googleAuthCode,
String googleIntegrityToken,
String name,
Object playerData,
String playerToken,
boolean restore
) throws IOException
Registers or logs in via a Google Play Games server auth code. Pass restore true only after the player explicitly confirms a deletion-restore prompt; the fresh provider credential can recover the account even after a reinstall. Shorter overloads default restore to false.
public static <T> PlayerAuthResponse<T> authenticatePlayer(
Client client,
String playerToken,
Class<T> dataType
) throws IOException
Authenticates a player using their private token. Returns player information with typed data support.
public static PlayerListResponse getAllPlayers(
Client client
) throws IOException
Retrieves a list of all players (requires private API token).
public static PlayerHeartbeatResponse sendPlayerHeartbeat(
Client client,
String playerToken
) throws IOException
Updates player heartbeat to maintain online status. Call every 30-60 seconds.
public static PlayerLogoutResponse logoutPlayer(
Client client,
String playerToken
) throws IOException
Logs out a player and updates their last logout timestamp.
public static PlayerRenameResponse renamePlayer(
Client client,
String playerToken,
String newName
) throws IOException
Renames a player to a new name. Validates name length (2-50 characters) and requires player authentication.
public static PlayerDeleteResponse deleteAccount(
Client client,
String playerToken
) throws IOException
Schedules player-initiated account deletion. The account freezes immediately and is purged after the 30-day grace window unless restored. Keep the player credential during the window; responses expose isDeletionPending() and getPurgeAfter().
public static PlayerRestoreResponse restoreAccount(
Client client,
String playerToken
) throws IOException
Cancels a pending deletion. This must be an explicit player action, never an automatic login or background retry. Provider-linked accounts can also restore after reinstall by signing in with the provider and restore set after confirmation.
public static PlayerBanResponse banPlayer(
Client client,
int playerId,
EBanTime banDuration,
String banReason
) throws IOException
Bans a player from the game with specified duration (HOUR, DAY, WEEK, MONTH, QUARTER, YEAR, FOREVER) and optional reason. Requires private API token.
public static PlayerUnbanResponse unbanPlayer(
Client client,
int playerId
) throws IOException
Unbans a previously banned player. Requires private API token.
public static boolean isBanned(ApiResponse response)
Checks if an API response indicates the player is banned. Returns true if the error message contains "You are banned".
Register creates the player and returns the token your game stores and presents as X-Game-Player-Token. Login re-opens the session on a later run; heartbeat keeps the player marked online while they play; logout ends the session cleanly. Rotate issues a fresh credential and invalidates the old one — call it any time a token may have leaked.
Registration and rename validate the display name server-side against your game's name rules — allowed scripts, case policy and symbols, edited in the cabinet — plus the profanity screen. A rejected name comes back as a fielded error you can show the player instead of guessing why it failed.