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;
@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;

View File

@ -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.
*

View File

@ -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.
*

View File

@ -176,10 +176,12 @@ public class WorldManager implements MVWorldManager {
boolean wasAutoSave = false;
if (oldWorld != null && oldWorld.getCBWorld().isAutoSave()) {
wasAutoSave = true;
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)) {
Logging.warning("Failed to copy files for world '%s', see the log info", newName);