Loads unloaded world before deleting (#2431)

* Loads unload world before deleting

Fixes issue where unloaded worlds can't be deleted.

* Missing commit line smh
This commit is contained in:
Ben Woo 2020-10-08 10:38:45 +08:00 committed by GitHub
parent 9fce6c54f6
commit 146075de69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -525,6 +525,13 @@ public class WorldManager implements MVWorldManager {
*/
@Override
public boolean deleteWorld(String name, boolean removeFromConfig, boolean deleteWorldFolder) {
if (this.hasUnloadedWorld(name, false)) {
// Attempt to load if unloaded so we can actually delete the world
if (!this.doLoad(name)) {
return false;
}
}
World world = this.plugin.getServer().getWorld(name);
if (world == null) {
// We can only delete loaded worlds
@ -937,6 +944,9 @@ public class WorldManager implements MVWorldManager {
return this.configWorlds;
}
/**
* {@inheritDoc}
*/
@Override
public boolean hasUnloadedWorld(String name, boolean includeLoaded) {
if (getMVWorld(name) != null) {