mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 23:26:45 +01:00
Minor cleanup of new party stuff.
This commit is contained in:
parent
637442149c
commit
62a037a4fd
@ -22,16 +22,20 @@ public class ShareHandler {
|
|||||||
EQUAL,
|
EQUAL,
|
||||||
};
|
};
|
||||||
|
|
||||||
public static double checkXpSharing(int oldExp, Player player, Party party, SkillType type) {
|
public static double checkXpSharing(int oldExp, Player player, Party party) {
|
||||||
int newExp = oldExp;
|
int newExp = oldExp;
|
||||||
|
|
||||||
if (party.getExpShareMode() == null) {
|
if (party.getExpShareMode() == null) {
|
||||||
party.setExpShareMode("NO_SHARE");
|
party.setExpShareMode("NO_SHARE");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (party.getExpShareMode().equals("NO_SHARE")) {
|
if (party.getExpShareMode().equals("NO_SHARE")) {
|
||||||
return newExp;
|
return newExp;
|
||||||
} else if (party.getExpShareMode().equals("EQUAL")) {
|
|
||||||
newExp = (int) calculateSharedExp(oldExp, player, party, type);
|
|
||||||
}
|
}
|
||||||
|
else if (party.getExpShareMode().equals("EQUAL")) {
|
||||||
|
newExp = (int) calculateSharedExp(oldExp, player, party);
|
||||||
|
}
|
||||||
|
|
||||||
return newExp;
|
return newExp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,13 +45,14 @@ public class ShareHandler {
|
|||||||
* @param int XP without party sharing
|
* @param int XP without party sharing
|
||||||
* @return the party shared XP
|
* @return the party shared XP
|
||||||
*/
|
*/
|
||||||
public static double calculateSharedExp(int oldExp, Player player, Party party, SkillType type) {
|
public static double calculateSharedExp(int oldExp, Player player, Party party) {
|
||||||
int newExp = oldExp;
|
int newExp = oldExp;
|
||||||
List<Player> nearMembers = PartyManager.getNearMembers(player, party, partyShareRange);
|
List<Player> nearMembers = PartyManager.getNearMembers(player, party, partyShareRange);
|
||||||
|
|
||||||
if (nearMembers.size() > 0) {
|
if (nearMembers.size() > 0) {
|
||||||
newExp = (int) ((oldExp / (nearMembers.size() + 1)) * partyShareBonus);
|
newExp = (int) ((oldExp / (nearMembers.size() + 1)) * partyShareBonus);
|
||||||
}
|
}
|
||||||
|
|
||||||
return newExp;
|
return newExp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,7 +525,7 @@ public class SkillTools {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (profile.inParty()) {
|
if (profile.inParty()) {
|
||||||
xp = (int) ShareHandler.checkXpSharing(xp, player, profile.getParty(), type);
|
xp = (int) ShareHandler.checkXpSharing(xp, player, profile.getParty());
|
||||||
ShareHandler.handleEqualExpShare(xp, player, profile.getParty(), type);
|
ShareHandler.handleEqualExpShare(xp, player, profile.getParty(), type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user