2.1.212 - Fixed herbalism exploit and added damage limit for XP

calculations used in combat
This commit is contained in:
nossr50 2022-04-28 18:31:10 -07:00
parent 4a8630262e
commit d19cf1e260
6 changed files with 35 additions and 2 deletions

View File

@ -1,3 +1,10 @@
Version 2.1.212
An herbalism exploit has been patched (thanks WhatsTheBadNews)
Added 'ExploitFix.Combat.XPCeiling.Enabled' to experience.yml
Added 'ExploitFix.Combat.XPCeiling.Damage_Limit' to experience.yml
Single instances of combat damage above 100 give are capped to give the same reward as 100 by default (100 is a lot, but you can change this in settings)
NOTES: The damage ceiling won't affect server that don't have mobs running around with abnormally high health, if your server does you'll want to adjust this limit or disable it.
Version 2.1.211
Added /mmodebug info for players hitting other players
Fixed Immortal Player bug

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.1.211</version>
<version>2.1.212</version>
<name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm>

View File

@ -25,6 +25,12 @@ public class ExperienceConfig extends BukkitConfig {
validate();
}
@Override
public void initDefaults() {
config.addDefault("ExploitFix.Combat.XPCeiling.Enabled", true);
config.addDefault("ExploitFix.Combat.XPCeiling.Damage_Limit", 100);
}
public static ExperienceConfig getInstance() {
if (instance == null) {
instance = new ExperienceConfig();
@ -423,6 +429,13 @@ public class ExperienceConfig extends BukkitConfig {
public boolean getAddExtraDetails() {
return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.ExtraDetails", false);
}
public boolean useCombatHPCeiling() {
return config.getBoolean("ExploitFix.Combat.XPCeiling.Enabled", true);
}
public int getCombatHPCeiling() {
return config.getInt("ExploitFix.Combat.XPCeiling.HP_Modifier_Limit", 100);
}
public boolean isExperienceBarsEnabled() {
return config.getBoolean("Experience_Bars.Enable", true);

View File

@ -1,5 +1,7 @@
package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.experience.XPGainReason;
import com.gmail.nossr50.datatypes.experience.XPGainSource;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
@ -39,6 +41,10 @@ public class AwardCombatXpTask extends BukkitRunnable {
damage += health;
}
if(ExperienceConfig.getInstance().useCombatHPCeiling()) {
damage = Math.min(damage, ExperienceConfig.getInstance().getCombatHPCeiling());
}
mcMMOPlayer.beginXpGain(primarySkillType, (int) (damage * baseXp), xpGainReason, XPGainSource.SELF);
}
}

View File

@ -732,7 +732,10 @@ public final class CombatUtils {
* @param primarySkillType The skill being used
* @param multiplier final XP result will be multiplied by this
*/
public static void processCombatXP(@NotNull McMMOPlayer mcMMOPlayer, @NotNull LivingEntity target, @NotNull PrimarySkillType primarySkillType, double multiplier) {
public static void processCombatXP(@NotNull McMMOPlayer mcMMOPlayer,
@NotNull LivingEntity target,
@NotNull PrimarySkillType primarySkillType,
double multiplier) {
double baseXP = 0;
XPGainReason xpGainReason;

View File

@ -25,6 +25,10 @@
EarlyGameBoost:
Enabled: true
ExploitFix:
Combat:
XPCeiling:
Enabled: true
Damage_Limit: 100
COTWBreeding: true
UnsafeEnchantments: false
# Prevent many exploits related to fishing