Skip to content

Website Integrations

This section documents the integration points between the game servers and the website/external services.

Player API V2

The Player API is an internal HTTP server running on the Survival Mix server via Skript (player-api.sk). It allows the website and other services to query real-time player data.

  • Port: 12002
  • Method: GET for all endpoints
  • Source File: server_configs/survivalmix/plugins/Skript/scripts/player-api.sk

Endpoints

GET /api/lastlogout/{player_name}

Returns the last logout timestamp for a player. Used to display "Last Seen" on profile pages.

Response (200 OK):

{
  "name": "PlayerName",
  "uuid": "uuid-string",
  "last_logout": "Date String",
  "relative_time": "2 hours ago",
  "timestamp": 1705583920000
}

GET /api/balance/{player_name}

Returns the player's economy balance.

Response (200 OK):

{
  "name": "PlayerName",
  "uuid": "uuid-string",
  "balance": 1500.50
}

GET /api/name/{uuid}

Resolves a UUID to the latest known player name.

Response (200 OK):

{
  "uuid": "uuid-string",
  "name": "PlayerName"
}

GET /api/discord/name/{discord_id}

Resolves a Discord ID to the linked Minecraft player name. Requires Discordsrv database linkage.

Response (200 OK):

{
  "discord_id": "123456789",
  "name": "PlayerName",
  "uuid": "uuid-string"
}

GET /api/discord/id/{player_name}

Resolves a Minecraft player name to their linked Discord ID.

Response (200 OK):

{
  "name": "PlayerName",
  "discord_id": "123456789",
  "uuid": "uuid-string"
}

GET /api/chat/public

Returns the recent public chat history buffer.

Response (200 OK):

[
  "Message 1",
  "Message 2",
  "..."
]

Error Handling

Status Code Description
400 Bad Request (Missing parameters)
404 Not Found (Player or ID not found)
500 Internal Server Error (Plugin missing, DB error)

Database Connections

The API connects to the kaizenmc_discordsrv database to perform Discord ID lookups. - Connection Variable: {sql::db::player_api} - Refresh: Automatically reconnects on script load and every 2 hours.