From fc74c582bf3d9bf8c10117d0f42c5b25ce7730a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Sun, 10 May 2020 21:52:57 +0200 Subject: [PATCH] Add option to disable deletion of plot backups when the plot is unclaimed --- .../java/com/plotsquared/core/configuration/Settings.java | 2 ++ Core/src/main/java/com/plotsquared/core/plot/Plot.java | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java index 6db5f8476..1e24cc1cf 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java @@ -420,6 +420,8 @@ public class Settings extends Config { public static boolean AUTOMATIC_BACKUPS = true; @Comment("Maximum amount of backups associated with a plot") public static int BACKUP_LIMIT = 3; + @Comment("Whether or not backups should be deleted when the plot is unclaimed") + public static boolean DELETE_ON_UNCLAIM = true; } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/Plot.java b/Core/src/main/java/com/plotsquared/core/plot/Plot.java index 0a25e4cdd..e77861b94 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/Plot.java +++ b/Core/src/main/java/com/plotsquared/core/plot/Plot.java @@ -1360,9 +1360,10 @@ public class Plot { PlotListener.plotExit(pp, current); } - // Destroy all backups when the plot is unclaimed - Objects.requireNonNull(PlotSquared.imp()).getBackupManager() - .getProfile(current).destroy(); + if (Settings.Backup.DELETE_ON_UNCLAIM) { + // Destroy all backups when the plot is unclaimed + Objects.requireNonNull(PlotSquared.imp()).getBackupManager().getProfile(current).destroy(); + } getArea().removePlot(getId()); DBFunc.delete(current);