All requests that require account authorization (i.e. to be "logged in") require a POST/GET field user and hash.
useris the username for the account. It is case-insensitive.hashis the hashed form of the account's password. The account password can be calculated using the following algorithm:
CharSequence hash = bin2hex(whirlpool(password + uid) ^ sha512(uid + password))| Symbol | Description |
|---|---|
^ |
bitwise XOR combination |
password |
the exact password of the player (without any trimming, etc.), which is entered on the server |
uid |
the user ID, accessible (and cacheable) through the getUid API |
The response of BA requests are always in JSON. An extra fancy field (with any or no value) can be used to indicate that indents and line breaks are expected in the response (JSON_PRETTY_PRINT).
However, if the HTTP response code is 500 Internal Server Error, it means that the server has crashed and they may be no content in the response output.
BA responses always have two fields:
status: A boolean value to indicate whether the request is successfulerror: The error message, ornullifstatusistrue
getUid is an API without BA required. It can be used to convert any usernames into a user ID.
GET /api/getUid.php
Parameters:
| Parameter | Description |
|---|---|
| user | The username of the user, case-insensitive |
Response
- HTTP response code
400 Bad Request: Theuserparameter is missing. There will be no output in the response. - HTTP response code
404 Not Found: There is no user associated with the given username. There will be no output in the response. - HTTP response code
200 OK: The request is successful and database returned a valid result. The user ID in number form (e.g.12345) is in the response output.
The postChat API is a basic-authorization API used for posting chat messages.
POST /api/chat.php
Parameters:
| Parameter | Description |
|---|---|
type |
the type of the message |
msg |
the chat message |
There are also extra parameter fields as specified in the chat types section.
Response
id is a unique ID of the message.
{
"status" => true,
"error" => null,
"id" => 3
}Class refers to the server type, namely:
| Name | Value | Description |
|---|---|---|
| CLASS_ALL | 0 | Wildcard for all servers |
| CLASS_HUB = 1 | Hub server | |
| CLASS_KITPVP | 2 | KitPvP server |
| CLASS_PARKOUR | 3 | Parkour server |
| CLASS_SPLEEF | 4 | Spleef server |
| CLASS_INFECTED | 5 | Infected server |
| CLASS_CLASSICAL | 6 | Classical PvP server |
| CLASS_NON_SERVER | 7 | Not a server (e.g. from website, API, etc.) |
There are multiple chat types, namely:
| Type name | Type ID | Type description | GET Authorization | data fields in GET |
POST Authorization | Extra POST fields |
|---|---|---|---|---|---|---|
SERVER_BROADCAST |
0 | A network-wide broadcast message | BA as any user | nil | BA as admin | nil |
TEAM_CHAT |
1 | A chat message in the team's chatroom | BA as team member or moderator | tid (team ID) |
BA as team member | tid (team ID) |
teamName (team name) |
||||||
ign (speaker name) |
||||||
data (only exists as parameters for the message if translatable) |
||||||
CONSOLE_MESSAGE |
2 | A message sent to console | BA as admin | ip (IP of the server sent from) |
BA as any user | nil |
{ip:"legionpvp.eu",port:80} means sent from API |
port (port of the server sent from) |
|||||
CHANNEL_CHAT |
3 | A chat message on a certain channel | BA as any user | channel (channel to send to) |
BA as any user on that channel | channel (channel to send to) |
fromClass (source of message) |
||||||
ign (speaker name) |
||||||
level (0 for verbose, 1 for normal) |
||||||
data (only exists as parameters fro the message if translatable) |
||||||
MUTE_CHAT |
4 | A propaganda that a certain player has been muted | BA as any user | since (UNIX timestamp as time of mute) |
BA as a moderator | since (UNIX timestamp as time of mute) |
length (number of seconds of mute) |
length (number of seconds of mute) |
|||||
uid (user ID to mute) |
||||||
ip (IP to mute) |
||||||
cid (client ID to mute) |
||||||
PRIVATE_MESSAGE |
5 | Private message to a player | BA as any user | nil | BA as any user | uid (user ID of target player) |
- BA: Basic Authentication
- MF: Minecraft-formatted (with the section sign as the font identifier)