fix(ServerModpackCompletionTask): 修复已禁用模组仍被下载的问题 #5333
+8
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
问题
修复服务端自动更新整合包时,用户主动禁用的模组(
.disabled/.old)会被错误地判定为"丢失"并重新下载的问题(#3955)。根本原因
之前的逻辑在判断是否需要下载时,会优先检查目标文件是否存在(
!Files.exists(actualPath))。对于已禁用的模组,其原始文件名(如Mod.jar)确实不存在(已被重命名为Mod.jar.disabled),导致逻辑误判为文件丢失,从而触发下载。此前的修复尝试(如处理运算符优先级)未能解决核心的逻辑顺序问题。
修复逻辑
重构了
ServerModpackCompletionTask.java中的判断逻辑:.disabled或.old。download = false,跳过后续所有检查。这一修改确保了用户禁用的模组不会在更新时“复活”。
Fixes #3955