forked from Upstream/mmocore
Fixed an issue with party buffs
This commit is contained in:
parent
8417ca60ca
commit
c3145bf3b3
@ -94,10 +94,10 @@ public class Party {
|
|||||||
MMOCore.plugin.requestManager.registerRequest(request);
|
MMOCore.plugin.requestManager.registerRequest(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
@Override
|
||||||
// public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
// return obj instanceof Party && ((Party) obj).uuid.equals(uuid);
|
return obj instanceof Party && ((Party) obj).owner.getUniqueId().equals(owner.getUniqueId());
|
||||||
// }
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* this class makes controling entries and departures and APPLYING PARTY
|
* this class makes controling entries and departures and APPLYING PARTY
|
||||||
@ -117,14 +117,14 @@ public class Party {
|
|||||||
public void add(PlayerData player) {
|
public void add(PlayerData player) {
|
||||||
members.add(player);
|
members.add(player);
|
||||||
|
|
||||||
refreshAttributes();
|
members.forEach(member -> applyAttributes(member));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove(PlayerData player) {
|
public void remove(PlayerData player) {
|
||||||
members.remove(player);
|
members.remove(player);
|
||||||
|
|
||||||
refreshAttributes();
|
members.forEach(member -> applyAttributes(member));
|
||||||
refreshAttributes(player);
|
clearAttributes(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void forEach(Consumer<? super PlayerData> action) {
|
public void forEach(Consumer<? super PlayerData> action) {
|
||||||
@ -135,12 +135,12 @@ public class Party {
|
|||||||
return members.size();
|
return members.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshAttributes() {
|
private void applyAttributes(PlayerData player) {
|
||||||
members.forEach(member -> refreshAttributes(member));
|
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) {
|
private void clearAttributes(PlayerData player) {
|
||||||
MMOCore.plugin.partyManager.getBonuses().forEach(stat -> player.getStats().getInstance(stat).addModifier("party", MMOCore.plugin.partyManager.getBonus(stat)));
|
MMOCore.plugin.partyManager.getBonuses().forEach(stat -> player.getStats().getInstance(stat).remove("mmocoreParty"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,8 +105,6 @@ public class ConfigManager {
|
|||||||
messages = new ConfigFile("messages").getConfig();
|
messages = new ConfigFile("messages").getConfig();
|
||||||
hotbarSwap = MMOCore.plugin.getConfig().getBoolean("hotbar-swap");
|
hotbarSwap = MMOCore.plugin.getConfig().getBoolean("hotbar-swap");
|
||||||
chatInput = MMOCore.plugin.getConfig().getBoolean("use-chat-input");
|
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");
|
partyChatPrefix = MMOCore.plugin.getConfig().getString("party.chat-prefix");
|
||||||
formatSymbols.setDecimalSeparator(getFirstChar(MMOCore.plugin.getConfig().getString("number-format.decimal-separator"), ','));
|
formatSymbols.setDecimalSeparator(getFirstChar(MMOCore.plugin.getConfig().getString("number-format.decimal-separator"), ','));
|
||||||
combatLogTimer = MMOCore.plugin.getConfig().getInt("combat-log.timer");
|
combatLogTimer = MMOCore.plugin.getConfig().getInt("combat-log.timer");
|
||||||
|
@ -34,6 +34,7 @@ public class PartyManager extends MMOManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void unregisterParty(Party party) {
|
public void unregisterParty(Party party) {
|
||||||
|
// IMPORTANT: clears all party stats before unregistering the party
|
||||||
party.getMembers().forEach(member -> party.removeMember(member));
|
party.getMembers().forEach(member -> party.removeMember(member));
|
||||||
parties.remove(party);
|
parties.remove(party);
|
||||||
}
|
}
|
||||||
@ -45,7 +46,7 @@ public class PartyManager extends MMOManager {
|
|||||||
public StatModifier getBonus(StatType stat) {
|
public StatModifier getBonus(StatType stat) {
|
||||||
return buffs.get(stat);
|
return buffs.get(stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<StatType> getBonuses() {
|
public Set<StatType> getBonuses() {
|
||||||
return buffs.keySet();
|
return buffs.keySet();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user