From 7e65ff1ebca43cb2adb409dce0dadf91b93620b2 Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Thu, 31 May 2018 20:26:09 +0200 Subject: [PATCH] Remove edit instances before renaming a world; resolves #368 --- README.md | 2 +- .../java/de/erethon/dungeonsxl/command/RenameCommand.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 17099739..8d6eecac 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/src/main/java/de/erethon/dungeonsxl/command/RenameCommand.java b/src/main/java/de/erethon/dungeonsxl/command/RenameCommand.java index fedeb61a..bceb2236 100644 --- a/src/main/java/de/erethon/dungeonsxl/command/RenameCommand.java +++ b/src/main/java/de/erethon/dungeonsxl/command/RenameCommand.java @@ -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();