
服务器崩溃修复
在某些情况下,存在一些Hytale服务器漏洞可能导致服务器崩溃,此插件旨在修复并限制这些漏洞的影响。
服务器修复 1.1.1
本插件的目的是修复(或减轻)Hytale 服务器 jar 中存在的一系列 bug,这些 bug 可能导致服务器崩溃或世界线程崩溃。详见下方修复说明。
修复内容
空拾取物品目标引用崩溃
异常
java.lang.NullPointerException: Cannot invoke "com.hypixel.hytale.component.Ref.isValid()" because "targetRef" is null; at com.hypixel.hytale.server.core.modules.entity.item.PickupItemSystem.tick(PickupItemSystem.java:69); at com.hypixel.hytale.component.system.tick.EntityTickingSystem.doTick(EntityTickingSystem.java:92); at com.hypixel.hytale.component.system.tick.EntityTickingSystem.tick(EntityTickingSystem.java:36); at com.hypixel.hytale.component.Store.tick(Store.java:1971);
...
原因是什么?
当 PickupItemComponent 未使用设置 targetRef 的构造函数创建时(例如,通过编解码器生成或从数据加载),或者某些插件/模组意外传递了空值,就会发生此问题。
ServerFixes 如何修复?
ServerFixes 会监控无效的 PickupItem 实体,并在世界 tick 期间、PickupItemSystem 之前将其移除,从而防止崩溃。当发生此情况时,控制台会记录日志。
挂载组件原型崩溃缓解
异常
Exception in thread Thread[#72,WorldThread - default,5,InnocuousForkJoinWorkerThreadGroup]:
java.lang.IllegalArgumentException: ComponentType is not in archetype: ComponentType{} ........
at com.hypixel.hytale.component.Archetype.validateComponentType(Archetype.java:146)
at com.hypixel.hytale.component.Holder.removeComponent(Holder.java:304)
at com.hypixel.hytale.component.Store.removeComponent(Store.java:1254)
at com.hypixel.hytale.component.CommandBuffer.lambda$removeComponent$0(CommandBuffer.java:430)
at com.hypixel.hytale.component.CommandBuffer.consume(CommandBuffer.java:520)
原因是什么?
发生此错误是因为 ECS 事件中存在 validateComponentType 检查,用于确保组件确实存在。如果命令队列包含多个 RelativeMovement 或 AbsoluteMovement 更新(这在繁忙的服务器上非常可能发生),命令缓冲区最终会包含多个 "remove MountedComponent" 命令。第一个命令会更改实体的原型(此时组件已不存在),然后第二个移除操作会遇到 validateComponentType(...) 并抛出异常。
ServerFixes 如何修复?
ServerFixes 会监控 PlayerInput.getMovementUpdateQueue 并对其进行修剪,以确保当玩家挂载后超过 600 毫秒时,队列中仅包含一个移动事件。这可能会导致游戏中的轻微移动抖动,但这仅是一个微小的视觉问题,仅会在原本会导致世界崩溃的情况下发生。
onEntityRemove 中 npcReferences 的空指针异常:无法读取数组长度,"" 为空
异常
Exception in thread Thread[#151,WorldThread - default,5,InnocuousForkJoinWorkerThreadGroup]:
java.lang.NullPointerException: Cannot read the array length because "<local15>" is null
at com.hypixel.hytale.server.npc.systems.SpawnReferenceSystems$MarkerAddRemoveSystem.onEntityRemove(SpawnReferenceSystems.java:166)
at com.hypixel.hytale.component.Store.removeEntity(Store.java:848)
at com.hypixel.hytale.component.CommandBuffer.lambda$removeEntity$0(CommandBuffer.java:292) at com.hypixel.hytale.component.CommandBuffer.consume(CommandBuffer.java:520)
...
原因是什么?
当服务器移除一个 NPC 时,会运行一个清理钩子,用于更新该 NPC 的生成标记。在清理过程中,服务器通过循环遍历标记的列表来执行“从标记的列表中移除这个 NPC”。但由于列表为空,Java 在尝试循环时会立即崩溃(“无法读取数组长度,因为它为空”),导致世界线程终止。在失败的案例中,生成标记处于不一致的状态:
- 它仍然认为有 NPC 已生成(spawnCount > 0)
- 但其内部的 NPC 引用列表(npcReferences)缺失(null)
ServerFixes 如何修复?
ServerFixes 在服务器存在 bug 的清理代码之前添加了一个小型的预清理保护。
- 如果 NPC 正在被移除,并且关联的生成标记的 spawnCount > 0 且 npcReferences == null(这正是崩溃的条件),ServerFixes 会调整该标记的 spawnCount,以便服务器的清理代码跳过会循环空数组的分支。
救命!我的服务器受到致命服务器 bug 的影响,导致崩溃,但 Server Fixes 没有包含修复
欢迎通过本帖子链接的我的 Discord 服务器联系我,或者在 Discord 上给我发私信(jamo.sh)。我很乐意查看您的日志并在可能的情况下实施修复。
链接
正在加载版本记录…
正在加载评论…
评论在新手盒子客户端中发表,这里同步展示。