From 51a120bb6767275815afe44066faf041d3646c1f Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Fri, 30 Oct 2020 17:10:31 +0100 Subject: [PATCH] Fix groups using two group signs --- .../java/de/erethon/dungeonsxl/global/GroupSign.java | 5 ++++- .../main/java/de/erethon/dungeonsxl/player/DGroup.java | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/de/erethon/dungeonsxl/global/GroupSign.java b/core/src/main/java/de/erethon/dungeonsxl/global/GroupSign.java index 262f8349..d585714e 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/global/GroupSign.java +++ b/core/src/main/java/de/erethon/dungeonsxl/global/GroupSign.java @@ -136,11 +136,12 @@ public class GroupSign extends JoinSign { DGroup playerGroup = (DGroup) plugin.getPlayerGroup(player); if (playerGroup != null) { if (playerGroup.getLeader().equals(player)) { - if (group != null || maxElements < playerGroup.getMembers().size()) { + if (playerGroup.getGroupSign() != null || group != null || maxElements < playerGroup.getMembers().size()) { MessageUtil.sendMessage(player, DMessage.ERROR_LEAVE_GROUP.getMessage()); return; } else { group = playerGroup; + group.setGroupSign(this); group.setDungeon(dungeon); update(); return; @@ -165,8 +166,10 @@ public class GroupSign extends JoinSign { if (groupName != null) { group = new DGroup(plugin, groupName, player, dungeon); + group.setGroupSign(this); } else { group = new DGroup(plugin, player, dungeon); + group.setGroupSign(this); } update(); diff --git a/core/src/main/java/de/erethon/dungeonsxl/player/DGroup.java b/core/src/main/java/de/erethon/dungeonsxl/player/DGroup.java index b781fc23..16a691d1 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/player/DGroup.java +++ b/core/src/main/java/de/erethon/dungeonsxl/player/DGroup.java @@ -43,6 +43,7 @@ import de.erethon.dungeonsxl.config.DMessage; import de.erethon.dungeonsxl.dungeon.DDungeon; import de.erethon.dungeonsxl.dungeon.DGame; import de.erethon.dungeonsxl.dungeon.DungeonConfig; +import de.erethon.dungeonsxl.global.GroupSign; import de.erethon.dungeonsxl.world.DGameWorld; import de.erethon.dungeonsxl.world.DResourceWorld; import java.util.ArrayList; @@ -69,6 +70,7 @@ public class DGroup implements PlayerGroup { private int id; private String name; + private GroupSign groupSign; private Player captain; private PlayerCollection players = new PlayerCollection(); private PlayerCollection invitedPlayers = new PlayerCollection(); @@ -177,6 +179,14 @@ public class DGroup implements PlayerGroup { this.name = name; } + public GroupSign getGroupSign() { + return groupSign; + } + + public void setGroupSign(GroupSign groupSign) { + this.groupSign = groupSign; + } + @Override public Player getLeader() { return captain;