mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2025-01-23 16:41:28 +01:00
Fix /dxl rename; resolves #454
This commit is contained in:
parent
fef6a1f39d
commit
53f8ec8584
@ -25,6 +25,7 @@ import de.erethon.dungeonsxl.dungeon.DungeonConfig;
|
||||
import de.erethon.dungeonsxl.global.GameSign;
|
||||
import de.erethon.dungeonsxl.global.GlobalProtection;
|
||||
import de.erethon.dungeonsxl.global.GroupSign;
|
||||
import de.erethon.dungeonsxl.global.JoinSign;
|
||||
import de.erethon.dungeonsxl.player.DPermission;
|
||||
import de.erethon.dungeonsxl.world.DEditWorld;
|
||||
import de.erethon.dungeonsxl.world.DResourceWorld;
|
||||
@ -99,20 +100,18 @@ public class RenameCommand extends DRECommand {
|
||||
}
|
||||
|
||||
boolean changed = false;
|
||||
for (GlobalProtection protection : plugin.getGlobalProtections().getProtections()) {
|
||||
if (protection instanceof GroupSign) {
|
||||
Dungeon dungeon = ((GroupSign) protection).getDungeon();
|
||||
if (dungeon.getName().equals(args[1])) {
|
||||
dungeon.setName(args[2]);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
} else if (protection instanceof GameSign) {
|
||||
Dungeon dungeon = ((GameSign) protection).getDungeon();
|
||||
if (dungeon.getName().equals(args[1])) {
|
||||
dungeon.setName(args[2]);
|
||||
changed = true;
|
||||
}
|
||||
for (GlobalProtection protection : plugin.getGlobalProtections().getProtections().toArray(new GlobalProtection[]{})) {
|
||||
if (!(protection instanceof JoinSign)) {
|
||||
continue;
|
||||
}
|
||||
Dungeon dungeon = ((JoinSign) protection).getDungeon();
|
||||
if (dungeon == null) {
|
||||
protection.delete();
|
||||
continue;
|
||||
}
|
||||
if (dungeon.getName().equals(args[1])) {
|
||||
dungeon.setName(args[2]);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user