Remove edit instances before renaming a world; resolves #368

This commit is contained in:
Daniel Saukel 2018-05-31 20:26:09 +02:00
parent b73b7d5554
commit 7e65ff1ebc
2 changed files with 8 additions and 1 deletions

View File

@ -55,7 +55,7 @@ Building DungeonsXL from source requires [Apache Maven](https://maven.apache.org
Maven automatically fetches all dependencies and builds DungeonsXL; just run _build.bat_ or enter the command _mvn clean install_.
#### DRECommons
[DRECommons](https://github.com/DRE2N/DRECommons) is a util library for common tasks. DungeonsXL contains DRECommons 4.1.
[DRECommons](https://github.com/DRE2N/DRECommons) is a util library for common tasks. DungeonsXL contains DRECommons 4.1.1.
#### Caliburn API
[Caliburn](https://github.com/DRE2N/CaliburnAPI) is an API to read custom items and mobs from config files. DungeonsXL contains Caliburn Beta 0.4.

View File

@ -26,6 +26,7 @@ import de.erethon.dungeonsxl.global.GameSign;
import de.erethon.dungeonsxl.global.GlobalProtection;
import de.erethon.dungeonsxl.global.GroupSign;
import de.erethon.dungeonsxl.player.DPermission;
import de.erethon.dungeonsxl.world.DEditWorld;
import de.erethon.dungeonsxl.world.DResourceWorld;
import java.io.File;
import java.io.IOException;
@ -62,6 +63,12 @@ public class RenameCommand extends DRECommand {
resource.getFolder().renameTo(new File(DungeonsXL.MAPS, args[2]));
resource.getSignData().updateFile(resource);
for (DEditWorld editWorld : plugin.getDWorlds().getEditWorlds()) {
if (editWorld.getResource() == resource) {
editWorld.delete(true);
}
}
for (Dungeon dungeon : plugin.getDungeons().getDungeons()) {
DungeonConfig dConfig = dungeon.getConfig();
FileConfiguration config = dConfig.getConfig();