From f2d1acd24ac8701837208a3d8a23bcc80883fa6e Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Mon, 12 Dec 2022 19:41:53 +0100 Subject: [PATCH] Call the backup cleaner method --- .../lib/paper/modules/backup/CompressProcess.java | 6 ++++++ .../java/fr/pandacube/lib/paper/modules/backup/Type.java | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/modules/backup/CompressProcess.java b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/modules/backup/CompressProcess.java index 250b4b7..ba5dd2f 100644 --- a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/modules/backup/CompressProcess.java +++ b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/modules/backup/CompressProcess.java @@ -104,6 +104,12 @@ public abstract class CompressProcess implements Comparable, Ru backupManager.persist.updateDirtyStatusAfterCompress(type, name); displayDirtynessStatus(); + + try { + type.backupCleaner(backupManager.config).cleanupArchives(targetDir); + } catch (Exception e) { + Log.severe(e); + } } catch (final Exception e) { Log.severe("[Backup] Failed: " + sourceDir + " -> " + target, e); diff --git a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/modules/backup/Type.java b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/modules/backup/Type.java index 10dbd37..f08da41 100644 --- a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/modules/backup/Type.java +++ b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/modules/backup/Type.java @@ -15,5 +15,12 @@ public enum Type { case WORKDIR -> cfg.workdirBackupEnabled; }; } + + public BackupCleaner backupCleaner(BackupConfig cfg) { + return switch (this) { + case WORLDS -> cfg.worldBackupCleaner; + case WORKDIR -> cfg.workdirBackupCleaner; + }; + } }