From 0d41d0982c4d2a6a59c4ddb34af7aa758cb48272 Mon Sep 17 00:00:00 2001 From: citylion Date: Wed, 17 Jul 2024 22:13:06 -0500 Subject: [PATCH] Added option to disable saving of world when cloning. --- .../MultiverseCore/MultiverseCoreConfiguration.java | 13 +++++++++++++ .../MultiverseCore/api/MVWorldManager.java | 4 +++- .../MultiverseCore/api/MultiverseCoreConfig.java | 4 ++++ .../MultiverseCore/utils/WorldManager.java | 8 +++++--- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCoreConfiguration.java b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCoreConfiguration.java index aaf21275..d5bb8b1d 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCoreConfiguration.java +++ b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCoreConfiguration.java @@ -77,6 +77,8 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements private volatile boolean autopurge; @Property private volatile boolean idonotwanttodonate; + @Property + private volatile boolean clone_saving; public MultiverseCoreConfiguration() { super(); @@ -111,6 +113,7 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements portalsearchradius = 128; autopurge = true; idonotwanttodonate = false; + clone_saving=false; // END CHECKSTYLE-SUPPRESSION: MagicNumberCheck } @@ -378,6 +381,16 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements return !idonotwanttodonate; } + @Override + public boolean doCloneSaving(){ + return clone_saving; + } + + @Override + public void setCloneSaving(boolean doSaving){ + this.clone_saving=doSaving; + } + @Override public void setShowDonateMessage(boolean showDonateMessage) { this.idonotwanttodonate = !showDonateMessage; diff --git a/src/main/java/com/onarandombox/MultiverseCore/api/MVWorldManager.java b/src/main/java/com/onarandombox/MultiverseCore/api/MVWorldManager.java index 599ce7cb..01be6b93 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/api/MVWorldManager.java +++ b/src/main/java/com/onarandombox/MultiverseCore/api/MVWorldManager.java @@ -25,7 +25,9 @@ import java.util.List; * This API contains all of the world managing * functions that your heart desires! */ -public interface MVWorldManager { +public interface + +MVWorldManager { /** * Add a new World to the Multiverse Setup. * diff --git a/src/main/java/com/onarandombox/MultiverseCore/api/MultiverseCoreConfig.java b/src/main/java/com/onarandombox/MultiverseCore/api/MultiverseCoreConfig.java index 07b2bb91..66560e13 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/api/MultiverseCoreConfig.java +++ b/src/main/java/com/onarandombox/MultiverseCore/api/MultiverseCoreConfig.java @@ -233,6 +233,10 @@ public interface MultiverseCoreConfig extends ConfigurationSerializable { */ boolean isShowingDonateMessage(); + boolean doCloneSaving(); + + void setCloneSaving(boolean doSaving); + /** * Sets whether or not the donation/patreon messages are shown. * diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java b/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java index 0b2ab070..29504cb7 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java +++ b/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java @@ -176,9 +176,11 @@ public class WorldManager implements MVWorldManager { boolean wasAutoSave = false; if (oldWorld != null && oldWorld.getCBWorld().isAutoSave()) { wasAutoSave = true; - Logging.config("Saving world '%s'", oldName); - oldWorld.getCBWorld().setAutoSave(false); - oldWorld.getCBWorld().save(); + if(plugin.getMVConfig().doCloneSaving()){ + Logging.config("Saving world '%s'", oldName); + oldWorld.getCBWorld().setAutoSave(false); + oldWorld.getCBWorld().save(); + } } Logging.config("Copying files for world '%s'", oldName); if (!FileUtils.copyFolder(oldWorldFile, newWorldFile, ignoreFiles)) {