BetterLANBroadcaster-Velocity
BetterLANBroadcaster-Velocity 是一款轻量级的 Velocity 代理插件,通过 UDP 多播实现 Minecraft 原生局域网服务器发现功能。
它允许运行在 Velocity 代理后面的 Minecraft 服务器通过 Minecraft 内置的局域网发现机制进行广播,从而让同一局域网内的兼容 Minecraft 客户端在多人游戏菜单中直接看到这些服务器,无需玩家手动输入服务器地址。
该插件注重简洁可靠的设计,支持可配置的联网设置、运行时控制、多语言支持以及极低的资源开销。
功能特性
- ? 使用 UDP 多播实现 Minecraft 原生局域网服务器发现
- ? 专为 Velocity 设计
- ⚙️ 可配置广播间隔和广播服务器端口
- ? 自定义 MOTD(服务器简介),支持
{online} 和 {max} 占位符
- ? 自动或手动选择网络接口
- ? 支持多个网络接口
- ? 可选的网络接口排除功能
- ? 支持启动、停止、重载及运行时重新配置
- ? 运行时状态与广播统计信息
- ? 可配置的调试日志记录,减少日志刷屏
- ? 多语言消息支持,涵盖 18 种语言
- ? 缺失或不可用翻译时自动回退至英文
- ?️ 输入验证与安全性的运行时重新配置
- ♻️ 受控的 Socket 和执行器生命周期管理
- ☕ 支持 Java 21
支持的语言
该插件目前包含以下语言:
- ?? 英语 (
en)
- ?? 巴西葡萄牙语 (
br)
- ?? 中文 (
zh)
- ?? 西班牙语 (
es)
- ?? 德语 (
de)
- ?? 法语 (
fr)
- ?? 日语 (
ja)
- ?? 俄语 (
ru)
- ?? 意大利语 (
it)
- ?? 韩语 (
ko)
- ?? 荷兰语 (
nl)
- ?? 波兰语 (
pl)
- ?? 土耳其语 (
tr)
- ?? 乌克兰语 (
uk)
- ?? 越南语 (
vi)
- ?? 印度尼西亚语 (
id)
- ?? 捷克语 (
cs)
- ?? 瑞典语 (
sv)
当所选翻译不可用或不完整时,将使用英语作为后备语言。
依赖要求
- Velocity 3.4.0 或更高版本
- Java 21 或更高版本
- 支持原生局域网服务器发现的 Minecraft 客户端
工作原理
BetterLANBroadcaster-Velocity 定期使用 Minecraft 的局域网服务器发现协议发送 UDP 多播数据包。
Velocity 继续处理玩家连接和服务器路由,而 BetterLANBroadcaster-Velocity 则将该代理作为局域网服务器进行广播。
该插件使用:
- 多播地址:
224.0.2.60
- UDP 端口:
4445
- IPv4 多播
- UTF-8 负载编码
- 多播 TTL:
1
广播的数据包遵循 Minecraft 的局域网发现格式:
[MOTD]MOTD[/MOTD][AD]PORT[/AD]
例如:
[MOTD]My Minecraft Server[/MOTD][AD]25565[/AD]
如有必要,广播端口可以与代理的实际监听配置独立设置。
MOTD 占位符
MOTD 支持以下占位符:
| 占位符 |
描述 |
{online} |
当前连接到 Velocity 代理的玩家数量 |
{max} |
代理报告的最大玩家容量 |
示例:
motd: "<green>My Network</green> <gray>[{online}/{max}]</gray>"
MOTD 支持 Unicode 和 Adventure MiniMessage 格式化。在传输之前,生成的数据包会被清理并限制在安全的 UDP 数据包大小范围内。
网络接口
该插件支持自动和手动接口选择。
自动模式
network-interface: auto
在自动模式下,插件会探测合适的 IPv4 网络接口,并在适当的情况下通过多个接口进行广播。
这对于拥有多条活动网络路径的系统非常有用,例如:
- 以太网和 Wi-Fi
- 物理 LAN 适配器
- VPN 接口
- 虚拟网络适配器
手动模式
可以通过名称或 IPv4 地址选择特定的接口。
当机器拥有多个适配器且希望将局域网发现限制在特定网络时,这非常有用。
排除接口
可以选择从自动选择中排除不需要的接口。
这有助于防止不必要的多播流量通过虚拟适配器、VPN、开发环境或其他不参与局域网发现的网路接口。
网络配置、操作系统防火墙规则、VPN 软件、路由、多播支持以及虚拟适配器可能会影响发现行为。
配置
该插件提供以下配置选项:
- 语言
- 启用/禁用广播
- 广播间隔
- 广播端口
- 网络接口
- 网络接口排除列表
- MOTD
- 调试日志
示例:
language: br
broadcast-enabled: true
broadcast-delay-ms: 1500
broadcast-port: auto
network-interface: auto
network-interface-exclude: []
motd: "<green>Meu Servidor</green> <gray>[{online}/{max}]</gray>"
debug: false
配置文件可以在运行时重载,无需重启代理。
命令
所有管理命令均使用 /blb 命令。
/blb start
/blb stop
/blb status
/blb setmotd <motd>
/blb setdelay <milliseconds>
/blb setport <port|auto>
/blb setinterface <auto|name|IPv4>
/blb debug [on|off]
/blb reload
/blb help
/blb version
在适用的情况下,该插件还提供命令建议/自动补全功能。
管理命令需要相应的插件权限。
运行时行为
BetterLANBroadcaster-Velocity 设计为在持续运行时保持轻量级。
广播模块使用:
- 专用的计划执行器
- 单个计划的广播任务
- 每个选定的网络接口一个 UDP Socket
- 缓存的多播目标信息
- 受控的接口发现机制
- 安全的 Socket 关闭与重建
- 速率限制的诊断日志记录
网络接口不会在每次广播时枚举。它们仅在广播模块启动、重新配置或在网络故障后需要恢复时才进行评估。
兼容性
本插件适用于以下环境:
- Velocity
- Java 21+
- Windows
- Linux
- 支持 IPv4 的网络环境
多播(Multicast)行为可能因操作系统、网络驱动程序、防火墙、路由器、VPN 软件以及虚拟适配器而异。
特别是 Radmin VPN、ZeroTier、Tailscale、Hamachi、Hyper-V、VMware、VirtualBox、Docker 和 WSL 等 VPN 和虚拟网络软件,可能会影响哪些接口支持或路由多播流量。
对于具有多个网络接口的环境,手动选择接口或排除特定接口可能会提供更可预测的行为。
性能
BetterLANBroadcaster-Velocity 旨在对 Velocity 代理服务器产生最小的影响。
该实现避免了不必要的轮询和重复的网络接口枚举,最小化了广播循环期间的对象创建,在可行时复用运行时资源,并将网络操作与代理的主插件生命周期隔离开来。
本插件不会为每个网络接口创建一个线程,也不会执行持续的网络扫描。
bStats
BetterLANBroadcaster-Velocity 包含 bStats,用于收集匿名的插件使用统计数据。
这些指标旨在提供关于插件使用和配置趋势的通用信息,同时避免收集不必要的个人信息。
bStats 仅用于遥测分析,并非插件局域网发现功能所必需的。
基于 BetterLANBroadcaster
BetterLANBroadcaster-Velocity 是 myxxr 开发的原始 BetterLANBroadcaster 项目的 Velocity 移植版本及重大修改版。
原始项目是为 Bukkit/Spigot 生态系统设计的。本项目将功能适配至 Velocity,并进行了以下方面的更改:
- Velocity 平台集成
- 插件生命周期管理
- UDP 多播网络
- 网络接口处理
- 配置管理
- 运行时重新配置
- 命令处理
- 语言和翻译处理
- 日志记录
- 资源和套接字管理
原始项目地址:
项目仓库中保留了原始的致谢信息。
问题与贡献
欢迎提交错误报告、建议以及贡献代码。
在报告问题时,请尽可能包含以下信息:
- Velocity 版本
- Java 版本
- Minecraft 客户端版本
- 操作系统
- 网络配置
- 插件配置
- 相关的控制台日志
- 服务器是否使用了 VPN 或虚拟网络适配器
这些信息在诊断多播发现问题时尤其有用。
GitHub 仓库:
许可证
请参阅仓库中的许可证文件以获取适用的许可证和再分发条款。
BetterLANBroadcaster-Velocity
BetterLANBroadcaster-Velocity is a lightweight Velocity proxy plugin that enables Minecraft's native LAN server discovery through UDP multicast.
It allows Minecraft servers running behind a Velocity proxy to be advertised through Minecraft's built-in LAN discovery mechanism, making them visible in the Multiplayer menu of compatible Minecraft clients on the same local network without requiring players to manually enter the server address.
The plugin focuses on a simple and reliable design, with configurable networking, runtime controls, multilingual support, and minimal overhead.
Features
- ? Native Minecraft LAN server discovery using UDP multicast
- ? Designed specifically for Velocity
- ⚙️ Configurable broadcast interval and advertised server port
- ? Customizable MOTD with
{online} and {max} placeholders
- ? Automatic or manual network interface selection
- ? Support for multiple network interfaces
- ? Optional network interface exclusions
- ? Start, stop, reload, and runtime reconfiguration
- ? Runtime status and broadcast statistics
- ? Configurable debug logging with reduced log spam
- ? Multilingual messages with 18 supported languages
- ? Automatic English fallback for missing or unavailable translations
- ?️ Input validation and safer runtime reconfiguration
- ♻️ Controlled socket and executor lifecycle
- ☕ Java 21 support
Supported Languages
The plugin currently includes:
- ?? English (
en)
- ?? Brazilian Portuguese (
br)
- ?? Chinese (
zh)
- ?? Spanish (
es)
- ?? German (
de)
- ?? French (
fr)
- ?? Japanese (
ja)
- ?? Russian (
ru)
- ?? Italian (
it)
- ?? Korean (
ko)
- ?? Dutch (
nl)
- ?? Polish (
pl)
- ?? Turkish (
tr)
- ?? Ukrainian (
uk)
- ?? Vietnamese (
vi)
- ?? Indonesian (
id)
- ?? Czech (
cs)
- ?? Swedish (
sv)
English is used as the fallback language when a selected translation is unavailable or incomplete.
Requirements
- Velocity 3.4.0 or newer
- Java 21 or newer
- A Minecraft client that supports native LAN server discovery
How It Works
BetterLANBroadcaster-Velocity periodically sends UDP multicast packets using Minecraft's LAN server discovery protocol.
Velocity continues to handle player connections and server routing, while BetterLANBroadcaster-Velocity advertises the proxy as a LAN server.
The plugin uses:
- Multicast address:
224.0.2.60
- UDP port:
4445
- IPv4 multicast
- UTF-8 payload encoding
- Multicast TTL:
1
The advertised payload follows Minecraft's LAN discovery format:
[MOTD]MOTD[/MOTD][AD]PORT[/AD]
For example:
[MOTD]My Minecraft Server[/MOTD][AD]25565[/AD]
The advertised port can be configured independently from the proxy's actual listening configuration when necessary.
MOTD Placeholders
The MOTD supports:
| Placeholder |
Description |
{online} |
Current number of players connected to the Velocity proxy |
{max} |
Maximum player capacity reported by the proxy |
Example:
motd: "<green>My Network</green> <gray>[{online}/{max}]</gray>"
The MOTD supports Unicode and Adventure MiniMessage formatting. Before transmission, the generated payload is sanitized and constrained to a safe UDP packet size.
Network Interfaces
The plugin supports both automatic and manual interface selection.
Automatic
network-interface: auto
In automatic mode, the plugin discovers suitable IPv4 network interfaces and can advertise through multiple interfaces when appropriate.
This is useful for systems with more than one active network path, such as:
- Ethernet and Wi-Fi
- Physical LAN adapters
- VPN interfaces
- Virtual network adapters
Manual
An interface can be selected by name or IPv4 address.
This can be useful when a machine has several adapters and LAN discovery should be restricted to a specific network.
Excluding Interfaces
Unwanted interfaces can optionally be excluded from automatic selection.
This can help prevent unnecessary multicast traffic through virtual adapters, VPNs, development environments, or other network interfaces that are not intended to participate in LAN discovery.
Network configuration, operating system firewall rules, VPN software, routing, multicast support, and virtual adapters may affect discovery behavior.
Configuration
The plugin provides configuration options for:
- Language
- Broadcast enabled/disabled
- Broadcast interval
- Advertised port
- Network interface
- Network interface exclusions
- MOTD
- Debug logging
Example:
language: br
broadcast-enabled: true
broadcast-delay-ms: 1500
broadcast-port: auto
network-interface: auto
network-interface-exclude: []
motd: "<green>Meu Servidor</green> <gray>[{online}/{max}]</gray>"
debug: false
The configuration can be reloaded at runtime without restarting the proxy.
Commands
All administrative commands use the /blb command.
/blb start
/blb stop
/blb status
/blb setmotd <motd>
/blb setdelay <milliseconds>
/blb setport <port|auto>
/blb setinterface <auto|name|IPv4>
/blb debug [on|off]
/blb reload
/blb help
/blb version
The plugin also provides command suggestions/autocomplete where applicable.
Administrative commands require the appropriate plugin permission.
Runtime Behavior
BetterLANBroadcaster-Velocity is designed to remain lightweight while running continuously.
The broadcaster uses:
- A dedicated scheduled executor
- A single scheduled broadcast task
- One UDP socket per selected network interface
- Cached multicast destination information
- Controlled interface discovery
- Safe socket shutdown and recreation
- Rate-limited diagnostic logging
Network interfaces are not enumerated on every broadcast. They are evaluated when the broadcaster starts, is reconfigured, or when recovery is required after a network failure.
Compatibility
The plugin is designed for:
- Velocity
- Java 21+
- Windows
- Linux
- IPv4-capable network environments
Multicast behavior may vary between operating systems, network drivers, firewalls, routers, VPN software, and virtual adapters.
In particular, VPN and virtual-network software such as Radmin VPN, ZeroTier, Tailscale, Hamachi, Hyper-V, VMware, VirtualBox, Docker, and WSL can affect which interfaces support or route multicast traffic.
For environments with multiple network interfaces, manual interface selection or interface exclusions may provide more predictable behavior.
Performance
BetterLANBroadcaster-Velocity is intended to have minimal impact on the Velocity proxy.
The implementation avoids unnecessary polling and repeated network-interface enumeration, minimizes object creation during the broadcast loop, reuses runtime resources where practical, and keeps network operations isolated from the proxy's main plugin lifecycle.
The plugin does not create a thread per network interface and does not perform continuous network scanning.
bStats
BetterLANBroadcaster-Velocity includes bStats for anonymous plugin usage statistics.
The metrics are intended to provide general information about plugin usage and configuration trends while avoiding the collection of unnecessary personal information.
bStats is used for telemetry only and is not required for the plugin's LAN discovery functionality.
Based on BetterLANBroadcaster
BetterLANBroadcaster-Velocity is a Velocity port and substantial modification of the original BetterLANBroadcaster project by myxxr.
The original project was designed for the Bukkit/Spigot ecosystem. This project adapts the functionality to Velocity and includes changes to:
- Velocity platform integration
- Plugin lifecycle management
- UDP multicast networking
- Network interface handling
- Configuration management
- Runtime reconfiguration
- Command handling
- Language and translation handling
- Logging
- Resource and socket management
Original project:
Original credits are preserved in the project repository.
Issues & Contributions
Bug reports, suggestions, and contributions are welcome.
When reporting an issue, please include, when possible:
- Velocity version
- Java version
- Minecraft client version
- Operating system
- Network configuration
- Plugin configuration
- Relevant console logs
- Whether the server is using VPN or virtual network adapters
This information can be especially useful when diagnosing multicast discovery problems.
GitHub:
License
See the repository's license file for the applicable license and redistribution terms.
评论 0
登录后参与评分
还没有评论,来抢沙发吧