Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to disable saving of source world when cloning. #3077

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ public static MultiverseCoreConfiguration getInstance() {
private volatile boolean autopurge;
@Property
private volatile boolean idonotwanttodonate;
@Property
private volatile boolean clone_saving;

public MultiverseCoreConfiguration() {
super();
Expand Down Expand Up @@ -111,6 +113,7 @@ protected void setDefaults() {
portalsearchradius = 128;
autopurge = true;
idonotwanttodonate = false;
clone_saving=false;
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
}

Expand Down Expand Up @@ -378,6 +381,16 @@ public boolean isShowingDonateMessage() {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
* 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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,11 @@ public boolean cloneWorld(String oldName, String newName) {
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)) {
Expand Down