mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-30 00:56:47 +01:00
Fixed double rounding of shared Xp, rounding up final result instead
This commit is contained in:
parent
60033d47ec
commit
1898537149
@ -37,17 +37,20 @@ public final class ShareHandler {
|
|||||||
*/
|
*/
|
||||||
public static void handleEqualXpShare(int xp, Player player, Party party, SkillType skillType) {
|
public static void handleEqualXpShare(int xp, Player player, Party party, SkillType skillType) {
|
||||||
running = true;
|
running = true;
|
||||||
int newExp = xp;
|
|
||||||
|
|
||||||
if (party.getXpShareMode() == XpShareMode.EQUAL) {
|
if (party.getXpShareMode() == XpShareMode.EQUAL) {
|
||||||
List<Player> nearMembers = PartyManager.getNearMembers(player, party, Config.getInstance().getPartyShareRange());
|
List<Player> nearMembers = PartyManager.getNearMembers(player, party, Config.getInstance().getPartyShareRange());
|
||||||
|
|
||||||
if (nearMembers.size() > 0) {
|
if (nearMembers.size() <= 0) {
|
||||||
newExp = (int) ((xp / (nearMembers.size() + 1)) * Config.getInstance().getPartyShareBonus());
|
running = false;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double partySize = nearMembers.size() + 1;
|
||||||
|
double splitXp = xp / partySize * Config.getInstance().getPartyShareBonus();
|
||||||
|
|
||||||
for (Player member : nearMembers) {
|
for (Player member : nearMembers) {
|
||||||
Users.getPlayer(member).addXp(skillType, newExp);
|
Users.getPlayer(member).addXp(skillType, (int) Math.ceil(splitXp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user