A Xinbot MetaPlugin for the 2b2t-cn.org anarchy server.
Starting from Xinbot 2.0.0, the bot requires exactly one MetaPlugin that encapsulates all server-specific interaction logic. This plugin makes Xinbot work out of the box on 2b2t-cn.org.
- Server connection — connects to
2b2t-cn.org(the SRV record is resolved automatically, like the vanilla client). - Cross-version support — the server runs 1.21.4 while the Xinbot core speaks a newer protocol; this plugin bridges the gap through XinVia (ViaVersion/ViaBackwards), installing the codec before the handshake.
- Automatic register / login — a declarative LoginFlow handles the AuthMe-style
/registerand/loginprompts, including the auto-login-after-register path. - Keep-alive fix — the server's proxy floods play-phase ping packets and kicks clients that never answer (
连接超时after ~60 s). The plugin answers every ping with a pong, like the vanilla client. - Auto respawn — the bot respawns immediately after death instead of idling on the death screen.
- Lobby support — if the network ever puts the bot on an adventure-mode lobby, the join item / server-selector container is used automatically.
The plugin makes the full event surface described in the Xinbot documentation work on 2b2t-cn.org:
| Event | Fired by | Notes |
|---|---|---|
PublicChatEvent |
this plugin | from vanilla player-chat packets and system-chat <name> message formats |
PrivateChatEvent |
this plugin | incoming whispers, detected via the minecraft:chat_type registry, plus Essentials/vanilla text formats |
LoginSuccessEvent / RegisterSuccessEvent |
LoginFlow | fired when the corresponding step succeeds |
SendCommandEvent / SendLoginCommandEvent / SendRegisterCommandEvent |
LoginFlow | cancellable / modifiable |
LoginFlowEvent |
LoginFlow | on every flow state change |
UseJoinItemEvent |
this plugin | cancellable, before using the lobby join item |
ConnectEvent, DisconnectEvent, SystemChatMessageEvent, OverlayUpdateEvent, PlayerJoinEvent, PlayerLeaveEvent, ServerChangeEvent, ReceivePacketEvent, SendChatMessageEvent |
Xinbot core | work unchanged with this plugin |
| Event | Description |
|---|---|
org.cn2b2t.meta.events.QueuePositionUpdateEvent |
queue position parsed from the overlay / action bar |
org.cn2b2t.meta.events.ClickJoinItemEvent |
cancellable, before clicking the join entry in a lobby container |
org.cn2b2t.meta.events.AutoRespawnEvent |
cancellable, before the automatic respawn |
Tested against the real 2b2t-cn.org game server (not a lobby — two bot clients in the same survival world saw each other join, chat, and leave):
ConnectEvent,ServerChangeEvent,LoginFlowEvent,RegisterSuccessEvent,LoginSuccessEvent,SendRegisterCommandEvent,DisconnectEvent— observed firing.PlayerJoinEvent/PlayerLeaveEvent— observed when the second client joined/left.PublicChatEvent— observed live: cross-player chat arrives as a vanilla player-chat packet and is classified through theminecraft:chat_typeregistry.PrivateChatEvent— same receiving path as public chat (only the chat type differs); the chat-type machinery is proven live and the text-format fallbacks are unit-tested. A live whisper could not be injected because the bot core sends unsigned command packets, which this server's whisper command drops.- Keep-alive ping/pong — a client stayed connected well past the ~60 s "连接超时" kick window.
- Download
xinbot-<version>.jarfrom Xinbot Releases (2.3.2 or newer). - Download
XinVia.jarfrom XinVia Releases and put it into thepluginfolder. - Download
CnOrgMetaPlugin-<version>.jarfrom Releases and put it into thepluginfolder. - Configure
config.confas described in the getting started guide. The server is offline-mode, soonlineMode: falseworks;passwordis used for the AuthMe login. - Run
java -jar xinbot-<version>.jar.
Requires Java 17+ and Maven:
mvn packageThe jar is produced in target/.