mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-22 10:36:06 +01:00
Option to disable the automatic purge of entities (#1933)
This commit is contained in:
parent
07df8d0d09
commit
d0180f05d5
@ -282,7 +282,9 @@ public class MVWorld implements MultiverseWorld {
|
||||
}
|
||||
world.setSpawnFlags(allowMonsters, allowAnimals);
|
||||
}
|
||||
plugin.getMVWorldManager().getTheWorldPurger().purgeWorld(MVWorld.this);
|
||||
if (MultiverseCoreConfiguration.getInstance().isAutoPurgeEnabled()) {
|
||||
plugin.getMVWorldManager().getTheWorldPurger().purgeWorld(MVWorld.this);
|
||||
}
|
||||
return super.validateChange(property, newValue, oldValue, object);
|
||||
}
|
||||
}
|
||||
|
@ -67,6 +67,8 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
private volatile boolean defaultportalsearch;
|
||||
@Property
|
||||
private volatile int portalsearchradius;
|
||||
@Property
|
||||
private volatile boolean autopurge;
|
||||
|
||||
public MultiverseCoreConfiguration() {
|
||||
super();
|
||||
@ -98,6 +100,7 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
silentstart = false;
|
||||
defaultportalsearch = false;
|
||||
portalsearchradius = 128;
|
||||
autopurge = true;
|
||||
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
|
||||
}
|
||||
|
||||
@ -332,4 +335,14 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
public int getPortalSearchRadius() {
|
||||
return portalsearchradius;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoPurgeEnabled() {
|
||||
return autopurge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAutoPurgeEnabled(boolean autopurge) {
|
||||
this.autopurge = autopurge;
|
||||
}
|
||||
}
|
||||
|
@ -199,4 +199,18 @@ public interface MultiverseCoreConfig extends ConfigurationSerializable {
|
||||
* @return The portal search radius.
|
||||
*/
|
||||
int getPortalSearchRadius();
|
||||
|
||||
/**
|
||||
* Gets whether or not the automatic purge of entities is enabled.
|
||||
*
|
||||
* @return True if automatic purge is enabled.
|
||||
*/
|
||||
boolean isAutoPurgeEnabled();
|
||||
|
||||
/**
|
||||
* Sets whether or not the automatic purge of entities is enabled.
|
||||
*
|
||||
* @param autopurge True if automatic purge should be enabled.
|
||||
*/
|
||||
void setAutoPurgeEnabled(boolean autopurge);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ package com.onarandombox.MultiverseCore.utils;
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCoreConfiguration;
|
||||
import com.onarandombox.MultiverseCore.WorldProperties;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
@ -474,7 +475,9 @@ public class WorldManager implements MVWorldManager {
|
||||
return false;
|
||||
}
|
||||
MVWorld world = new MVWorld(plugin, cbworld, mvworld);
|
||||
this.worldPurger.purgeWorld(world);
|
||||
if (MultiverseCoreConfiguration.getInstance().isAutoPurgeEnabled()) {
|
||||
this.worldPurger.purgeWorld(world);
|
||||
}
|
||||
this.worlds.put(worldName, world);
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user