Added option to disable saving of world when cloning.

This commit is contained in:
citylion 2024-07-17 22:13:06 -05:00
parent 17129f68d2
commit 0d41d0982c
4 changed files with 25 additions and 4 deletions

View File

@ -77,6 +77,8 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
private volatile boolean autopurge; private volatile boolean autopurge;
@Property @Property
private volatile boolean idonotwanttodonate; private volatile boolean idonotwanttodonate;
@Property
private volatile boolean clone_saving;
public MultiverseCoreConfiguration() { public MultiverseCoreConfiguration() {
super(); super();
@ -111,6 +113,7 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
portalsearchradius = 128; portalsearchradius = 128;
autopurge = true; autopurge = true;
idonotwanttodonate = false; idonotwanttodonate = false;
clone_saving=false;
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck // END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
} }
@ -378,6 +381,16 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
return !idonotwanttodonate; return !idonotwanttodonate;
} }
@Override
public boolean doCloneSaving(){
return clone_saving;
}
@Override
public void setCloneSaving(boolean doSaving){
this.clone_saving=doSaving;
}
@Override @Override
public void setShowDonateMessage(boolean showDonateMessage) { public void setShowDonateMessage(boolean showDonateMessage) {
this.idonotwanttodonate = !showDonateMessage; this.idonotwanttodonate = !showDonateMessage;

View File

@ -25,7 +25,9 @@ import java.util.List;
* This API contains all of the world managing * This API contains all of the world managing
* functions that your heart desires! * functions that your heart desires!
*/ */
public interface MVWorldManager { public interface
MVWorldManager {
/** /**
* Add a new World to the Multiverse Setup. * Add a new World to the Multiverse Setup.
* *

View File

@ -233,6 +233,10 @@ public interface MultiverseCoreConfig extends ConfigurationSerializable {
*/ */
boolean isShowingDonateMessage(); boolean isShowingDonateMessage();
boolean doCloneSaving();
void setCloneSaving(boolean doSaving);
/** /**
* Sets whether or not the donation/patreon messages are shown. * Sets whether or not the donation/patreon messages are shown.
* *

View File

@ -176,9 +176,11 @@ public class WorldManager implements MVWorldManager {
boolean wasAutoSave = false; boolean wasAutoSave = false;
if (oldWorld != null && oldWorld.getCBWorld().isAutoSave()) { if (oldWorld != null && oldWorld.getCBWorld().isAutoSave()) {
wasAutoSave = true; wasAutoSave = true;
Logging.config("Saving world '%s'", oldName); if(plugin.getMVConfig().doCloneSaving()){
oldWorld.getCBWorld().setAutoSave(false); Logging.config("Saving world '%s'", oldName);
oldWorld.getCBWorld().save(); oldWorld.getCBWorld().setAutoSave(false);
oldWorld.getCBWorld().save();
}
} }
Logging.config("Copying files for world '%s'", oldName); Logging.config("Copying files for world '%s'", oldName);
if (!FileUtils.copyFolder(oldWorldFile, newWorldFile, ignoreFiles)) { if (!FileUtils.copyFolder(oldWorldFile, newWorldFile, ignoreFiles)) {