Service Definition
The ServerManagement service is defined inkyber_api.proto:
Player Management
Kick Player
Removes a player from the server and creates a kick punishment record. Endpoint:ServerManagement.KickPlayer
Request:
Server ID
User ID of the player to kick
Reason for the kick
API/internal/rpc/server_management.go:217
Validation:
- User must be a moderator of the server
- Cannot kick the server host
- Creates a punishment record of type
KICK
Ban Player
Bans a player from the server, optionally for a specified duration. Endpoint:ServerManagement.BanPlayer
Request:
Server ID
User ID of the player to ban
Reason for the ban
Ban duration in seconds. Omit or set to 0 for permanent ban
API/internal/rpc/server_management.go:258
Validation:
- User must be a moderator of the server
- Cannot ban the server host
- Creates a punishment record of type
BAN - Player is kicked immediately
Unban Player
Removes an active ban for a player on a specific server. Endpoint:ServerManagement.UnbanPlayer
Request:
Server ID
User ID of the player to unban
API/internal/rpc/server_management.go:35
Validation:
- User must be a moderator of the server
- Punishment must exist and be active
- Records the moderator who overturned the ban
Punishment Management
Get Punishments
Retrieves all punishment records for a specific server. Endpoint:ServerManagement.GetPunishments
Request:
Server ID
Array of punishment records
API/internal/rpc/server_management.go:61
Punishment Object:
Unique punishment ID
Type of punishment:
KICK (0) or BAN (1)User ID of the moderator who issued the punishment
Player who received the punishment
Reason for the punishment
Unix timestamp when punishment was issued
Unix timestamp when punishment expires (null for permanent)
Full moderator information
Server Control
Run Command
Executes a console command on the server. Endpoint:ServerManagement.RunCommand
Request:
Server ID
Console command to execute
API/internal/rpc/server_management.go:201
Note: Command execution is logged and sent to the server console.
Moderator Management
Get Moderators
Retrieves the list of moderators for a specific server. Endpoint:ServerManagement.GetModerators
Request:
Server ID
Array of moderator user objects
API/internal/rpc/server_management.go:110
Add Moderator
Adds a user as a moderator for the current user’s servers. Endpoint:ServerManagement.AddModerator
Request:
User ID to add as moderator
API/internal/rpc/server_management.go:154
Validation:
- User must not already be a moderator
- Target user must exist
Remove Moderator
Removes a user from the moderator list. Endpoint:ServerManagement.RemoveModerator
Request:
User ID to remove as moderator
API/internal/rpc/server_management.go:182
Validation:
- User must be in the moderator list
Moderated Servers
Retrieves all servers that the current user has moderation privileges for. Endpoint:ServerManagement.ModeratedServers
Request: Empty
Response:
Array of server objects
Current page number (always 1 for this endpoint)
Total pages (always 1 for this endpoint)
API/internal/rpc/server_management.go:305
Behavior:
- Users with
EntitlementGlobalServerModeratorsee all servers - Users with
EntitlementOfficialServerModeratorsee all official servers - Regular users see only servers they host or moderate
Data Models
PunishmentType Enum
KyberPlayer
Server Object
See the Server Browser API documentation for the complete Server object definition.Authorization
Moderators are determined by:- Server Host - Creator of the server (stored in
server.HostID) - Assigned Moderators - Users in the host’s
ModeratorUserIDslist - Global Moderators - Users with
EntitlementGlobalServerModerator - Official Server Moderators - Users with
EntitlementOfficialServerModerator(for official servers only)
isModerator helper function (API/internal/rpc/server_management.go:352) to validate permissions.
Error Codes
NOT_FOUND(5) - Server, user, or punishment not foundPERMISSION_DENIED(7) - User is not a moderator of the serverINTERNAL(13) - Database or server communication errorALREADY_EXISTS(6) - User is already a moderator
WebSocket Events
Some server management actions trigger WebSocket events:- KickPlayer - Sends kick event to server via WebSocket
- BanPlayer - Sends kick event to server (ban is enforced on rejoin)
- RunCommand - Publishes command to server console and WebSocket subscribers
Implementation Notes
- Punishment records are stored permanently in the database
- Bans can be temporary (with expiration) or permanent (null expiration)
- Commands are logged with moderator information
- The server host cannot be kicked or banned from their own server