Fixed party exp splitting + new option

This commit is contained in:
Jules 2023-02-18 15:17:45 +01:00
parent 4ae7fa4387
commit 9e8daf4842
3 changed files with 9 additions and 5 deletions

View File

@ -783,7 +783,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
* If it's null, no hologram will be displayed
* @param splitExp Should the exp be split among party members
*/
public void giveExperience(double value, EXPSource source, @Nullable Location hologramLocation, boolean splitExp) {
public void giveExperience(double value, @NotNull EXPSource source, @Nullable Location hologramLocation, boolean splitExp) {
if (value <= 0) {
experience = Math.max(0, experience + value);
return;
@ -791,10 +791,10 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
// Splitting exp through party members
AbstractParty party;
if (splitExp && (party = getParty()) != null) {
if (splitExp && (party = getParty()) != null && MMOCore.plugin.configManager.splitMainExp) {
final List<PlayerData> nearbyMembers = party.getOnlineMembers().stream()
.filter(pd -> {
if (equals(pd) || pd.hasReachedMaxLevel())
if (equals(pd) || pd.hasReachedMaxLevel() || Math.abs(pd.getLevel() - getLevel()) > MMOCore.plugin.configManager.maxPartyLevelDifference)
return false;
final double maxDis = MMOCore.plugin.configManager.partyMaxExpSplitRange;

View File

@ -27,7 +27,7 @@ import java.util.logging.Level;
public class ConfigManager {
public final CommandVerbose commandVerbose = new CommandVerbose();
public boolean overrideVanillaExp, canCreativeCast, passiveSkillNeedBound, cobbleGeneratorXP, saveDefaultClassInfo, attributesAsClassInfo, splitProfessionExp, disableQuestBossBar, pvpModeEnabled;
public boolean overrideVanillaExp, canCreativeCast, passiveSkillNeedBound, cobbleGeneratorXP, saveDefaultClassInfo, attributesAsClassInfo, splitProfessionExp, splitMainExp, disableQuestBossBar, pvpModeEnabled;
public String partyChatPrefix, noSkillBoundPlaceholder;
public ChatColor staminaFull, staminaHalf, staminaEmpty;
public long combatLogTimer, lootChestExpireTime, lootChestPlayerCooldown, globalSkillCooldown;
@ -129,6 +129,7 @@ public class ConfigManager {
maxPartyLevelDifference = MMOCore.plugin.getConfig().getInt("party.max-level-difference");
partyMaxExpSplitRange = MMOCore.plugin.getConfig().getDouble("party.max-exp-split-range");
splitProfessionExp = MMOCore.plugin.getConfig().getBoolean("party.profession-exp-split");
splitMainExp = MMOCore.plugin.getConfig().getBoolean("party.main-exp-split");
disableQuestBossBar = MMOCore.plugin.getConfig().getBoolean("mmocore-quests.disable-boss-bar");
// Combat

View File

@ -153,7 +153,10 @@ party:
# Set to 0 to disable
max-exp-split-range: 48
# When enabled, being in a party also splits profession exp
# When enabled, being in a party splits class exp
main-exp-split: true
# When enabled, being in a party splits profession exp
profession-exp-split: false
# Not relevant when not using MMOCore as quest plugin