mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-12-23 04:47:37 +01:00
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 java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
public class PlayerData extends OfflinePlayerData implements Closable, ExperienceTableClaimer {
|
||||
@ -786,19 +787,26 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
if (value <= 0)
|
||||
return;
|
||||
|
||||
if (hasReachedMaxLevel()) {
|
||||
setExperience(0);
|
||||
return;
|
||||
}
|
||||
|
||||
// Splitting exp through party members
|
||||
AbstractParty party;
|
||||
if (splitExp && (party = getParty()) != null) {
|
||||
List<PlayerData> onlineMembers = party.getOnlineMembers();
|
||||
value /= onlineMembers.size();
|
||||
for (PlayerData member : onlineMembers)
|
||||
if (!equals(member))
|
||||
member.giveExperience(value, source, null, false);
|
||||
final List<PlayerData> nearbyMembers = party.getOnlineMembers().stream()
|
||||
.filter(pd -> {
|
||||
if (equals(pd) || pd.hasReachedMaxLevel())
|
||||
return 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
|
||||
|
@ -27,7 +27,7 @@ public class ConfigManager {
|
||||
public ChatColor staminaFull, staminaHalf, staminaEmpty;
|
||||
public long combatLogTimer, lootChestExpireTime, lootChestPlayerCooldown, globalSkillCooldown;
|
||||
public double lootChestsChanceWeight,dropItemsChanceWeight, fishingDropsChanceWeight, partyMaxExpSplitRange;
|
||||
public int maxPartyLevelDifference, maxBoundActiveSkills, maxBoundPassiveSkills, waypointWarpTime;
|
||||
public int maxPartyLevelDifference, maxBoundActiveSkills, maxBoundPassiveSkills;
|
||||
|
||||
private final FileConfiguration messages;
|
||||
|
||||
@ -82,8 +82,6 @@ public class ConfigManager {
|
||||
loadDefaultFile("skill-trees","rogue-marksman.yml");
|
||||
loadDefaultFile("skill-trees","warrior-paladin.yml");
|
||||
loadDefaultFile("skill-trees","general.yml");
|
||||
|
||||
|
||||
}
|
||||
|
||||
loadDefaultFile("attributes.yml");
|
||||
|
Loading…
Reference in New Issue
Block a user