From 18985371493e141da34261a652b3a8658aca4904 Mon Sep 17 00:00:00 2001 From: bm01 Date: Sat, 2 Feb 2013 04:33:26 +0100 Subject: [PATCH] Fixed double rounding of shared Xp, rounding up final result instead --- .../java/com/gmail/nossr50/party/ShareHandler.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/party/ShareHandler.java b/src/main/java/com/gmail/nossr50/party/ShareHandler.java index 8e4234cfa..e2123d766 100644 --- a/src/main/java/com/gmail/nossr50/party/ShareHandler.java +++ b/src/main/java/com/gmail/nossr50/party/ShareHandler.java @@ -37,17 +37,20 @@ public final class ShareHandler { */ public static void handleEqualXpShare(int xp, Player player, Party party, SkillType skillType) { running = true; - int newExp = xp; if (party.getXpShareMode() == XpShareMode.EQUAL) { List nearMembers = PartyManager.getNearMembers(player, party, Config.getInstance().getPartyShareRange()); - if (nearMembers.size() > 0) { - newExp = (int) ((xp / (nearMembers.size() + 1)) * Config.getInstance().getPartyShareBonus()); + if (nearMembers.size() <= 0) { + running = false; + return; } + double partySize = nearMembers.size() + 1; + double splitXp = xp / partySize * Config.getInstance().getPartyShareBonus(); + for (Player member : nearMembers) { - Users.getPlayer(member).addXp(skillType, newExp); + Users.getPlayer(member).addXp(skillType, (int) Math.ceil(splitXp)); } }