Skip to content

Commit

Permalink
Fix /dxl rename; resolves #454
Browse files Browse the repository at this point in the history
  • Loading branch information
Sataniel98 committed Aug 14, 2018
1 parent fef6a1f commit 53f8ec8
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/main/java/de/erethon/dungeonsxl/command/RenameCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
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;
Expand Down Expand Up @@ -99,20 +100,18 @@ public void onExecute(String[] args, CommandSender sender) {
}

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;
}
}

Expand Down

0 comments on commit 53f8ec8

Please sign in to comment.