Accounts and bots
Sign in Microsoft accounts and run scriptable bots on your servers.
A Bot is a Minecraft client that runs in your cluster and joins a server, powered by Minecraft-Console-Client (MCC). Bots for offline-mode servers just need a name. Bots for online servers need an Account: a Microsoft account that owns Minecraft.
Accounts
Creating an Account starts the Microsoft device code sign-in:
apiVersion: kobblestone.io/v1alpha1kind: Accountmetadata: name: farmhandspec: {}The account moves to phase AwaitingAuthorization, and its status shows a link and a code:
kubectl get account farmhand -o jsonpath='{.status.deviceFlow.message}'Open the link, enter the code and sign in with the Microsoft account. The account then becomes Authorized, and status.profile shows the Minecraft username and UUID.
From then on, Kobblestone refreshes the session on its own, by default one hour before it expires (spec.refreshBeforeExpiryMinutes). If a sign-in fails, for example because the code expired or the account has no Minecraft profile, the reason is in status.message and Kobblestone tries again after 10 minutes. Set spec.inactive: true to stop all sign-in attempts.
The session Secret
A signed-in account produces two Secrets:
<account>, of typekobblestone.io/minecraft-session, holds the current session:username,uuid,access-token, its expiry and, if available, the chat signing key pair. The same data is also stored as one JSON document insession.json. The format is documented and doesn’t depend on any client, so your own workloads can mount it too.<account>-credentialsholds the refresh token. It is never mounted into bots or other workloads, so they can use the session without being able to renew it.
Bots
apiVersion: kobblestone.io/v1alpha1kind: Botmetadata: name: farmerspec: target: targetRef: kind: Server name: survival auth: accountRef: name: farmhand signChat: true config: inline: | [ChatBot.AutoEat] Enabled = true scripts: - name: greet.txt runOnLogin: true inline: | send Hello from Kobblestone!Target
target.targetRef points at a Server or Network. To connect through a Router, or to any server outside the cluster, set target.host (and target.port if needed) to an address that leads there.
Authentication
With auth.accountRef, the bot joins as that account. It stays Pending until the account is authorized and restarts automatically with every refreshed session. auth.signChat: true signs chat messages with the account’s key. Without auth, the bot joins offline-mode servers as offlineUsername, which defaults to the bot’s name.
Programming a bot
Bots are programmed with MCC’s own tools; Kobblestone does not add its own scripting language.
- Configuration:
config.inlinetakes MCC configuration in TOML, the format ofMinecraftClient.ini. Use it to enable MCC’s built-in chat bots, such asAutoEat,AntiAFKorAutoRelog.config.fromadds more layers fromConfigMaps orSecrets, which is handy for shared settings or tokens. Later layers win. - Scripts:
scriptsplaces files in MCC’s working directory, inline or fromConfigMaps andSecrets. Files ending in.csare MCC C# scripts, all others are command scripts. WithrunOnLogin: true, a script runs after every login. - Files and data:
pod.volumesandpod.volumeMountsmount additional data. MCC’s working directory is/data, so a volume mounted at/data/filesis available to scripts asfiles/.
Some settings are always managed by Kobblestone and can’t be overridden, such as the account, the server address and the session handling.
Status
| Phase | Meaning |
|---|---|
Pending | The bot is starting or waiting for its account. |
Connected | The bot has joined its target. |
Disconnected | The bot was kicked, lost the connection or was rejected. It is restarted with backoff, and status.message holds the reason. |
Inactive | spec.inactive is true. |
A bot only ever runs once at a time: two instances logged in with the same account would kick each other.