Skip to content

Switching pack-type from zip to folder silently skips pack generation #480

Description

@duranaaron

Required

PackType.FOLDER.generate short circuits on target.exists() && zipHashFile.exists() && storedHash == hashOf(byteMap).

The stored hash is content based and does not encode the pack type. It also lives at plugins/BetterHud/.cache/zip-hash.txt, outside the folder it guards, and the check on the folder itself is existence rather than contents.

I hit this two ways, both on a clean server with BetterHud as the only plugin.

Config change, no manual deletion. Run once with pack-type: zip, then switch to folder and restart. BetterHud creates an empty build directory, matches the hash left over from the zip run, and skips generation. Clean enable, no error, no File packed line, nothing in the folder.

The general case, same guard. With pack-type: folder already working, empty the build folder and restart with zip-hash.txt in place.

Baseline, hash absent, builds normally:

[17:40:09 INFO]: [BetterHud] Enabling BetterHud v2.1.0-SNAPSHOT-447
[17:40:11 INFO]: [BetterHud] File packed: 5,637MB
[17:40:11 INFO]: [BetterHud] Plugin enabled.

build folder: 863 files
.cache/zip-hash.txt: dc0c3a63-8660-3091-ac96-e13ed394f71d

Build folder emptied, zip-hash.txt untouched:

build files before restart: 0

[17:40:35 INFO]: [BetterHud] Enabling BetterHud v2.1.0-SNAPSHOT-447
[17:40:37 INFO]: [BetterHud] Minecraft version: 1.21.11, NMS version: V1_21_R7
[17:40:37 INFO]: [BetterHud] Platform: Paper
[17:40:37 INFO]: [BetterHud] Plugin enabled.

build folder: 0 files

No File packed, nothing generated, hash unchanged. The plugin reports a successful enable while serving from a pack folder that does not exist.

zip-hash.txt deleted, build folder still empty:

[17:40:58 INFO]: [BetterHud] Enabling BetterHud v2.1.0-SNAPSHOT-447
[17:41:00 INFO]: [BetterHud] File packed: 5,637MB
[17:41:00 INFO]: [BetterHud] Plugin enabled.

build folder: 863 files

So the hash is the only thing guarding regeneration. Any loss of the folder contents that leaves .cache/zip-hash.txt behind is invisible, and a pack type change is enough on its own.

Logs are inline above.

  1. Environment
  • OS: macOS
  • Server version: 1.21.11
  • Server platform: Paper
  • BetterHud: 2.1.0-SNAPSHOT-447
  • Java: OpenJDK 25.0.3

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingquestionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions