All packets are in JSON format, and have at least a single command
field. Clientbound packets often have a status
field, utilising HTTP status codes to indicate success or failure.
{
"command": "command_name",
...
}
Unless specified by the individual packet, the status
field of a packet behaves in the following way:
200
to indicate success400
if there is any problem with the packet e.g. invalid JSON or missing/wrong type fields403
if the user is not logged in, and needs to be405
if the command doesn't make sense in the current context e.g.login
packet when already logged in
Register a new user with given username and password. Must be logged out. On successful user creation, the user will automatically be logged in. See clientbound register
packet.
Fields:
name
: [str] Initial username to assign to new userpasswd
: [str] Initial password to assign to new user
Log in user, either using username or uuid to identify the user. Either the ima,e
field or the uuid
field must be present, not both (or neither). See clientbound login
packet.
Fields:
passwd
: [str] User's passworduname
: [str] (optional) Username to log into. Must be present ifuuid
is not.uuid
: [int] (optional) UUID to log into. Must be present ifuname
is not.
Change the username of the currently logged in user. Must be logged in.
Fields:
nick
: [str] the new nickname to be applied
Return a list of online UUIDs. See clientbound online
packet.
Fields: None
Essentially do nothing, and send a 200
status code response.
Fields: None
Response to serverbound register
command.
Fields:
status
:405
if user is already logged inuuid
: [int] The UUID of the newly created user
Response to serverbound login
command.
Fields:
status
:405
if user is already logged inuuid
: [int] The UUID of the logged in user
Response to serverbound nick
command.
Fields:
status
:403
if user is not logged in
Return a list of online UUIDs. May be sent as a response to serverbound online
packet, or in response to a user joining or leaving.
Fields:
data
: List[int] List of UUIDsstatus
:403
if user is not logged in
Response to serverbound ping
command.
Fields:
status
: always200