JoinQueue
版本:NeoForge 1.21.1 & 1.21.8
防止因大量玩家同时加入服务器而导致的崩溃和 TPS 下降(例如在重启后或活动期间)。该模组在配置阶段将连接中的玩家放入等待队列,从而防止主线程过载。
功能
激活机制:默认设置下,队列始终处于激活状态(queue_activation_threshold = 0)。你可以设置一个阈值,仅当在线玩家数量超过该值时才激活队列。此外,在服务器重启后的宽限期内(默认 60 秒)或每当 TPS 降至 8.0 以下时,也会强制激活队列。
TPS 检查:仅在服务器稳定(TPS ≥ 8.0)且队列未暂停时释放玩家。在严重卡顿期间,自动停止释放。
释放速率:玩家按计时器进入服务器——默认为每 2 秒(普通玩家)和每 1 秒(VIP 玩家),可通过 ticks_between_joins / ticks_between_joins_vip 进行配置。
手动控制:管理员可以使用 /joinqueue pause 和 /joinqueue resume 手动停止或开始登录过程,或使用 /joinqueue toggle 启用/禁用整个模组。
优先级与绕过:
工作人员完全绕过队列。
VIP 玩家会被移至队列前端,并以更快的频率释放。
服务器满员处理:当服务器达到原版玩家上限时,普通玩家会被保留在队列中(显示“服务器已满”消息),直到有空位出现,而不是在网络层被拒绝。工作人员可绕过此限制,VIP 玩家也可能在超出限制的情况下加入。
异步区块加载:在玩家加入之前,在后台线程加载出生点区块(半径可配置,默认为 3),以防止主线程冻结。hold_back_ms 安全上限(默认 1500 毫秒)确保即使区块加载缓慢也能释放玩家。
队列界面:向玩家显示其在队列中的实时位置、队列总大小以及自定义(可配置)消息,包括队列暂停时的单独消息。
最小等待时间与队列容量限制:可选的 min_queue_seconds 强制每个玩家必须等待最短时间,max_queue_size 可以限制队列容纳的玩家数量。
命令
所有命令都需要权限等级 2(OP)。更改会自动保存并立即生效。
命令 描述
/joinqueue status 显示主开关、释放状态、服务器就绪状态、TPS、队列大小、阈值以及工作人员/VIP 计数。
/joinqueue toggle 启用或禁用整个模组(主开关)。
/joinqueue pause 暂停队列(玩家继续累积但不被释放)。
/joinqueue resume 恢复释放玩家。
/joinqueue reload 从 config/joinqueue.json 重新加载配置。
/joinqueue staff <add|remove> <player> 将玩家添加或移除出工作人员(绕过)列表。
/joinqueue vip <add|remove> <player> 将玩家添加或移除出 VIP(快速队列)列表。
/joinqueue list <staff|vip> 列出工作人员或 VIP 列表中的所有成员。
技术细节
完全在配置阶段运行,即在玩家完全加入世界之前。
使用 ConcurrentLinkedDeque 和 AtomicInteger 实现线程安全的性能。
通过基于 nanoTime 的滚动 40 刻钟环形缓冲区来测量 TPS。
通过 Mixin 扩展服务器保活超时时间(15 秒 → 2 分钟),以确保排队玩家在等待期间不会被踢出。
已释放但从未完成加入握手的玩家将在 15 秒后被丢弃,以防止队列停滞。
兼容 Arclight/hybrid 服务器(在这些服务器上会安全地跳过区块预加载)。
服务器端和客户端均需安装。
JoinQueue
Versions: NeoForge 1.21.1 & 1.21.8
Prevents server crashes and TPS drops caused by many players joining at the same time (e.g., after a restart or during events). The mod puts connecting players into a waiting line during the Configuration Phase, preventing the Main Thread from overloading.
Features
Activation: With default settings the queue is always active (queue_activation_threshold = 0). Set a threshold to only activate above a given online player count. It also force-activates during the grace period after a server restart (default 60s) or whenever TPS drops below 8.0.
TPS Check: Players are only released while the server is stable (TPS ≥ 8.0) and the queue is not paused. Releasing stops automatically during heavy lag.
Release Rate: Players are let in on a timer — by default every 2s (normal) and every 1s (VIP), configurable via ticks_between_joins / ticks_between_joins_vip.
Manual Control: Admins can use /joinqueue pause and /joinqueue resume to stop or start the login process manually, or /joinqueue toggle to enable/disable the whole mod.
Priority & Bypass:
Staff members bypass the queue entirely.
VIP players are moved to the front of the queue and released on a faster timer.
Server-Full Handling: When the server reaches its vanilla player cap, normal players are held in the queue (with a "Server is full" message) until a slot opens, instead of being rejected at the network layer. Staff bypass the limit and VIPs may join over it.
Async Chunk Loading: Loads spawn chunks on background threads (radius configurable, default 3) before a player joins to prevent main-thread freezes. A hold_back_ms safety ceiling (default 1500ms) guarantees release even if chunks are slow.
Queue Screen: Shows players their live position in line, the total queue size, and a custom (configurable) message, including a separate message when the queue is paused.
Minimum Wait & Size Cap: Optional min_queue_seconds forces every player to wait a minimum time, and max_queue_size can cap how many players the queue holds.
Commands
All commands require permission level 2 (OP). Changes are saved automatically and take effect immediately.
Command Description
/joinqueue status Shows master switch, release state, server-ready state, TPS, queue size, threshold and staff/VIP counts.
/joinqueue toggle Enables or disables the entire mod (master switch).
/joinqueue pause Pauses the queue (players accumulate but are not released).
/joinqueue resume Resumes releasing players.
/joinqueue reload Reloads the configuration from config/joinqueue.json.
/joinqueue staff <add|remove> <player> Adds or removes a player from the Staff (bypass) list.
/joinqueue vip <add|remove> <player> Adds or removes a player from the VIP (fast-queue) list.
/joinqueue list <staff|vip> Lists all members of the Staff or VIP list.
Technical Details
Runs entirely in the Configuration Phase, before the player fully joins the world.
Uses ConcurrentLinkedDeque and AtomicInteger for thread-safe performance.
TPS is measured via a rolling 40-tick ring buffer using nanoTime.
Extends the server keep-alive timeout (15s → 2min) via a Mixin so queued players are never kicked while waiting.
Released players that never complete the join handshake are dropped after 15s so the line never stalls.
Compatible with Arclight/hybrid servers (chunk preloading is safely skipped there).
Required on both server and client.
评论 0
登录后参与评分
还没有评论,来抢沙发吧