diff --git a/src/main/java/net/Indyuce/mmocore/api/player/social/Party.java b/src/main/java/net/Indyuce/mmocore/api/player/social/Party.java index 2ecf8d08..d5c7379d 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/social/Party.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/social/Party.java @@ -94,10 +94,10 @@ public class Party { MMOCore.plugin.requestManager.registerRequest(request); } - // @Override - // public boolean equals(Object obj) { - // return obj instanceof Party && ((Party) obj).uuid.equals(uuid); - // } + @Override + public boolean equals(Object obj) { + return obj instanceof Party && ((Party) obj).owner.getUniqueId().equals(owner.getUniqueId()); + } /* * this class makes controling entries and departures and APPLYING PARTY @@ -117,14 +117,14 @@ public class Party { public void add(PlayerData player) { members.add(player); - refreshAttributes(); + members.forEach(member -> applyAttributes(member)); } public void remove(PlayerData player) { members.remove(player); - refreshAttributes(); - refreshAttributes(player); + members.forEach(member -> applyAttributes(member)); + clearAttributes(player); } public void forEach(Consumer action) { @@ -135,12 +135,12 @@ public class Party { return members.size(); } - public void refreshAttributes() { - members.forEach(member -> refreshAttributes(member)); + private void applyAttributes(PlayerData player) { + MMOCore.plugin.partyManager.getBonuses().forEach(stat -> player.getStats().getInstance(stat).addModifier("mmocoreParty", MMOCore.plugin.partyManager.getBonus(stat).multiply(members.size() - 1))); } - public void refreshAttributes(PlayerData player) { - MMOCore.plugin.partyManager.getBonuses().forEach(stat -> player.getStats().getInstance(stat).addModifier("party", MMOCore.plugin.partyManager.getBonus(stat))); + private void clearAttributes(PlayerData player) { + MMOCore.plugin.partyManager.getBonuses().forEach(stat -> player.getStats().getInstance(stat).remove("mmocoreParty")); } } } diff --git a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java index a9e4a1da..630b072d 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java @@ -105,8 +105,6 @@ public class ConfigManager { messages = new ConfigFile("messages").getConfig(); hotbarSwap = MMOCore.plugin.getConfig().getBoolean("hotbar-swap"); chatInput = MMOCore.plugin.getConfig().getBoolean("use-chat-input"); - expPartyBuff = MMOCore.plugin.getConfig().getDouble("party.buff.experience"); - regenPartyBuff = MMOCore.plugin.getConfig().getDouble("party.buff.health-regen"); partyChatPrefix = MMOCore.plugin.getConfig().getString("party.chat-prefix"); formatSymbols.setDecimalSeparator(getFirstChar(MMOCore.plugin.getConfig().getString("number-format.decimal-separator"), ',')); combatLogTimer = MMOCore.plugin.getConfig().getInt("combat-log.timer"); diff --git a/src/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java b/src/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java index d00dc870..ad50aed9 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java @@ -34,6 +34,7 @@ public class PartyManager extends MMOManager { } public void unregisterParty(Party party) { + // IMPORTANT: clears all party stats before unregistering the party party.getMembers().forEach(member -> party.removeMember(member)); parties.remove(party); } @@ -45,7 +46,7 @@ public class PartyManager extends MMOManager { public StatModifier getBonus(StatType stat) { return buffs.get(stat); } - + public Set getBonuses() { return buffs.keySet(); }