forked from Upstream/mmocore
Fixed again party exp split range
This commit is contained in:
parent
4cb58398b0
commit
fa54ca10ed
@ -60,6 +60,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
public class PlayerData extends OfflinePlayerData implements Closable, ExperienceTableClaimer {
|
public class PlayerData extends OfflinePlayerData implements Closable, ExperienceTableClaimer {
|
||||||
@ -786,19 +787,26 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
if (value <= 0)
|
if (value <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (hasReachedMaxLevel()) {
|
|
||||||
setExperience(0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Splitting exp through party members
|
// Splitting exp through party members
|
||||||
AbstractParty party;
|
AbstractParty party;
|
||||||
if (splitExp && (party = getParty()) != null) {
|
if (splitExp && (party = getParty()) != null) {
|
||||||
List<PlayerData> onlineMembers = party.getOnlineMembers();
|
final List<PlayerData> nearbyMembers = party.getOnlineMembers().stream()
|
||||||
value /= onlineMembers.size();
|
.filter(pd -> {
|
||||||
for (PlayerData member : onlineMembers)
|
if (equals(pd) || pd.hasReachedMaxLevel())
|
||||||
if (!equals(member))
|
return false;
|
||||||
member.giveExperience(value, source, null, false);
|
|
||||||
|
final double maxDis = MMOCore.plugin.configManager.partyMaxExpSplitRange;
|
||||||
|
return maxDis <= 0 || pd.getPlayer().getLocation().distanceSquared(getPlayer().getLocation()) < maxDis * maxDis;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
value /= (nearbyMembers.size() + 1);
|
||||||
|
for (PlayerData member : nearbyMembers)
|
||||||
|
member.giveExperience(value, source, null, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Must be placed after exp splitting
|
||||||
|
if (hasReachedMaxLevel()) {
|
||||||
|
setExperience(0);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply buffs AFTER splitting exp
|
// Apply buffs AFTER splitting exp
|
||||||
|
@ -27,7 +27,7 @@ public class ConfigManager {
|
|||||||
public ChatColor staminaFull, staminaHalf, staminaEmpty;
|
public ChatColor staminaFull, staminaHalf, staminaEmpty;
|
||||||
public long combatLogTimer, lootChestExpireTime, lootChestPlayerCooldown, globalSkillCooldown;
|
public long combatLogTimer, lootChestExpireTime, lootChestPlayerCooldown, globalSkillCooldown;
|
||||||
public double lootChestsChanceWeight,dropItemsChanceWeight, fishingDropsChanceWeight, partyMaxExpSplitRange;
|
public double lootChestsChanceWeight,dropItemsChanceWeight, fishingDropsChanceWeight, partyMaxExpSplitRange;
|
||||||
public int maxPartyLevelDifference, maxBoundActiveSkills, maxBoundPassiveSkills, waypointWarpTime;
|
public int maxPartyLevelDifference, maxBoundActiveSkills, maxBoundPassiveSkills;
|
||||||
|
|
||||||
private final FileConfiguration messages;
|
private final FileConfiguration messages;
|
||||||
|
|
||||||
@ -82,8 +82,6 @@ public class ConfigManager {
|
|||||||
loadDefaultFile("skill-trees","rogue-marksman.yml");
|
loadDefaultFile("skill-trees","rogue-marksman.yml");
|
||||||
loadDefaultFile("skill-trees","warrior-paladin.yml");
|
loadDefaultFile("skill-trees","warrior-paladin.yml");
|
||||||
loadDefaultFile("skill-trees","general.yml");
|
loadDefaultFile("skill-trees","general.yml");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loadDefaultFile("attributes.yml");
|
loadDefaultFile("attributes.yml");
|
||||||
|
Loading…
Reference in New Issue
Block a user