mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2025-02-16 12:21:30 +01:00
#41: Also apply renaming to data
This commit is contained in:
parent
147ffa87fc
commit
58dca2850e
@ -22,6 +22,9 @@ import io.github.dre2n.dungeonsxl.DungeonsXL;
|
|||||||
import io.github.dre2n.dungeonsxl.config.DMessages;
|
import io.github.dre2n.dungeonsxl.config.DMessages;
|
||||||
import io.github.dre2n.dungeonsxl.config.DungeonConfig;
|
import io.github.dre2n.dungeonsxl.config.DungeonConfig;
|
||||||
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
|
||||||
|
import io.github.dre2n.dungeonsxl.global.GameSign;
|
||||||
|
import io.github.dre2n.dungeonsxl.global.GlobalProtection;
|
||||||
|
import io.github.dre2n.dungeonsxl.global.GroupSign;
|
||||||
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
import io.github.dre2n.dungeonsxl.player.DPermissions;
|
||||||
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
import io.github.dre2n.dungeonsxl.world.DResourceWorld;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -86,6 +89,27 @@ public class RenameCommand extends BRCommand {
|
|||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean changed = false;
|
||||||
|
for (GlobalProtection protection : plugin.getGlobalProtections().getProtections()) {
|
||||||
|
if (protection instanceof GroupSign) {
|
||||||
|
if (((GroupSign) protection).getMapName().equals(args[1])) {
|
||||||
|
((GroupSign) protection).setMapName(args[2]);
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (protection instanceof GameSign) {
|
||||||
|
if (((GameSign) protection).getMapName().equals(args[1])) {
|
||||||
|
((GameSign) protection).setMapName(args[2]);
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed) {
|
||||||
|
plugin.getGlobalProtections().saveAll();
|
||||||
|
}
|
||||||
|
|
||||||
MessageUtil.sendMessage(sender, DMessages.CMD_RENAME_SUCCESS.getMessage(args[1], args[2]));
|
MessageUtil.sendMessage(sender, DMessages.CMD_RENAME_SUCCESS.getMessage(args[1], args[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,6 +98,7 @@ public class DResourceWorld {
|
|||||||
*/
|
*/
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
folder.renameTo(new File(folder.getParentFile(), name));
|
folder.renameTo(new File(folder.getParentFile(), name));
|
||||||
|
folder = new File(folder.getParentFile(), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user