-
Notifications
You must be signed in to change notification settings - Fork 0
Cinnamon Minecraft Module
This module provides the Minecraft Integration feature to Cinnamon.
To include this feature, you must build Cinnamon with build tags minecraft
This module provides the ability for guilds to integrate their Minecraft servers with their respective guild.
When connecting to the websocket API, first JSON message should always be of IncomindData.datatype: negotiateapi containing the max supported API of the client. The bot replies with the highest API compatible between both client and server.
type IncomingData struct {
DataType string `json:"datatype"`
RawData json.RawMessage `json:"rawdata"`
}
type NegotiateAPI struct {
APIVersion int `json:"version"`
}
Maximum API supported by client.
int
type NegotiateAPI struct {
APIVersion int `json:"version"`
}
Highest API version appropriate to use between client and bot.
int
Valid API requests inbound from client.
type IncomingData struct{
DataType string `json:"datatype"`
RawData json.RawMessage `json:"rawdata"`
APIVersion int `json:"version"`
}
Type of raw data being sent over JSON field rawdata.
string: minecraft
Raw JSON data, differs according to datatype.
RAW JSON
API Version decided by the bot after negotiating API.
int: 1
First JSON message to the bot must always be of datatype "authenticate", if first message isn't of datatype "authenticate" then bot closes connection with HTTP Status 401 (Unauthorized).
type Data struct {
DataType string `json:"datatype"`
RawData json.RawMessage `json:"rawdata"`
AuthKey string `json:"authkey"`
}
Type of JSON data being sent over JSON:rawdata.
string authenticate
string playerjoinevent
string playermessageevent
Raw JSON data, differs according to JSON:datatype.
RAW JSON
Authentication key provided by bot.
String
Always sent immediately after negotiating API version over websocket. If message datatype is not authenticate, bot closes connection with HTTP Status 401 (Unauthorized). If authentication is successful, bot responds with HTTP Status 200 (OK) and keeps connection alive. If authentication fails, bot closes connection with HTTP Status 401 (Unauthorized).
type Authenticate struct {
AuthKey string `json:"authkey"`
DefaultChannel string `json:"channel"`
GuildID string `json:"guild"`
}
Authentication key provided by bot.
String
Default channel (ID) where to send messages sent to when receiving events that require the bot to send a message to the specified channel.
String
Default guild (ID) that the client is linked to.
String
Sent whenever a player sends a public message to the Minecraft chat.
type ChatMessage struct {
UUID string `json:"uuid"`
Message string `json:"message"`
Mention string `json:"mention"`
Channel string `json:"channel"`
}
Minecraft UUID of player sending the message.
String
Message content of chat message sent by player.
String
(Optional) Message ID sent on discord to reply to.
String
(Optional) Channel ID where the Message replying to was sent, only filled if replying to message.
String
Sent whenever a player logs into minecraft server. See OutboundData.datatype: playerauthkickevent playerauthevent usernotfoundevent to see what responses to expect.
type PlayerJoin struct {
UUID string `json:"uuid"`
}
Minecraft UUID of player that joined Minecraft server.
String
Valid API requests outbound from bot to client.
type OutboundData struct {
DataType string `json:"datatype"`
RawData json.RawMessage `json:"rawdata"`
API int `json:"version"`
}
Type of JSON data being sent over JSON:rawdata
string playerauthkickevent
string playerauthevent
string usernotfoundevent
Raw JSON data, differs according to JSON:datatype
RAW JSON
API version negotiated between bot and client.
int 1
Called in response to IncomingData.datatype: playerjoinevent if player authentication successful. If successful.
type playerAuthSuccessful struct {
UUID string `json:"uuid"`
Username string `json:"username"`
}
UUID of player authenticated into server.
String
Discord username of player authenticated into server. To be used to set minecraft nickname of player to this depending on the configuration.
String
Called in response to InboundData.datatype: playerjoinevent if user has not linked their Discord account with the bot.
type kickForAuth struct {
UUID string `json:"uuid"`
AuthKey string `json:"authkey"`
}
UUID of minecraft user to kick.
String
Authentication key linked with Minecraft player. When player kicked from server, display instruction on how to link account with their discord account, as well as this authentication key.
String
Called in response to InboundData.datatype: playerjoinevent if user is not present in server. User should be kicked depending on client configuration.
type kickForNotOnServer struct {
UUID string `json:"uuid"`
}
UUID of minecraft player not found present in discord server.
String