Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CnOrgMetaPlugin

简体中文

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.

Features

  • 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 /register and /login prompts, 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.

Events

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

Custom events

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

Verified on the live server

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 the minecraft:chat_type registry.
  • 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.

Installation

  1. Download xinbot-<version>.jar from Xinbot Releases (2.3.2 or newer).
  2. Download XinVia.jar from XinVia Releases and put it into the plugin folder.
  3. Download CnOrgMetaPlugin-<version>.jar from Releases and put it into the plugin folder.
  4. Configure config.conf as described in the getting started guide. The server is offline-mode, so onlineMode: false works; password is used for the AuthMe login.
  5. Run java -jar xinbot-<version>.jar.

Building

Requires Java 17+ and Maven:

mvn package

The jar is produced in target/.

License

GPL-3.0-or-later

About

Xinbot MetaPlugin for the 2b2t-cn.org anarchy server (auto register/login, cross-version via XinVia, keep-alive, full event support)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages