mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-24 19:45:43 +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.DungeonConfig;
|
||||
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.world.DResourceWorld;
|
||||
import java.io.File;
|
||||
@ -86,6 +89,27 @@ public class RenameCommand extends BRCommand {
|
||||
} 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]));
|
||||
}
|
||||
|
||||
|
@ -98,6 +98,7 @@ public class DResourceWorld {
|
||||
*/
|
||||
public void setName(String name) {
|
||||
folder.renameTo(new File(folder.getParentFile(), name));
|
||||
folder = new File(folder.getParentFile(), name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user