zip

public static File zip(File sourceDir, File outputDir, String zipName, BooleanSupplier cancellationRequested)

Zips a directory into a .zip file via atomic temp-then-rename. The write goes to <zipName>.zip.tmp first; only on a clean ZipOutputStream close do we Files.move(... ATOMIC_MOVE) into the final path. Guarantees that any reader of <zipName>.zip sees either the previous complete zip or the new complete zip — never a partially-written file. Necessary because GeyserPackProvider now serves this file live per Bedrock session, so a half-written zip would corrupt the pack handed to a joining player.

Return

the created zip File, or null on failure

Parameters

sourceDir

the directory to zip

outputDir

where to place the zip

zipName

the name of the zip file (without .zip extension)