package me.minidigger.voxelgameslib.utils;

import net.lingala.zip4j.core.ZipFile;
import net.lingala.zip4j.exception.ZipException;
import net.lingala.zip4j.model.ZipParameters;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import javax.annotation.Nonnull;

/**
 * Small util to make working with zips easier
 */
public class ZipUtil {

    /**
     * Creates a zip from all files and folders in the specified folder. DOES NOT INCLUDE THE FOLDER
     * ITSELF!
     *
     * @param file the folder which content should be zipped
     * @return the created zip
     * @throws ZipException if something goes wrong
     */
    @Nonnull
    public static ZipFile createZip(@Nonnull File file) throws ZipException {
        ZipFile zip = new ZipFile(new File(file.getParent(), file.getName() + ".zip"));
        ArrayList<File> fileList = new ArrayList<>();

        File[] files = file.listFiles();
        if (files == null) {
            return zip;
        }

        fileList.addAll(Arrays.asList(files));

        zip.createZipFile(fileList, new ZipParameters());

        return zip;
    }
}

@@ -197,61 +197,8 @@
 le;%0A
-import java.util.ArrayList;%0Aimport java.util.Arrays;%0A
 impo
@@ -768,24 +768,25 @@
 zip%22));%0A
+%0A
         
 ArrayLis
@@ -781,208 +781,96 @@
     
-ArrayList%3CFile%3E fileList = new ArrayList%3C%3E();%0A%0A        File%5B%5D files = file.listFiles();%0A        if (files == null) %7B%0A            return zip;%0A        %7D%0A%0A        fileList.addAll(Arrays.asList(files)
+ZipParameters params = new ZipParameters();%0A        params.setIncludeRootFolder(false
 );%0A
-%0A
     
@@ -881,51 +881,30 @@
 zip.
-createZipFile(fileList, new ZipParameters()
+addFolder(file, params
 );%0A%0A

fix zip util