From c267e4ff5b0955a135311027cd42f6c84d221767 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Fri, 1 Oct 2021 15:40:45 +0100 Subject: [PATCH] Fixed negative xp gain --- .../src/main/kotlin/com/willfp/ecoskills/EcoSkillsPlayer.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/EcoSkillsPlayer.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/EcoSkillsPlayer.kt index 510917b..a94f443 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/EcoSkillsPlayer.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/EcoSkillsPlayer.kt @@ -13,6 +13,7 @@ import org.bukkit.entity.Entity import org.bukkit.entity.Player import org.bukkit.entity.Projectile import java.util.* +import kotlin.math.abs val expMultiplierCache = mutableMapOf() val plugin: EcoSkillsPlugin = EcoSkillsPlugin.getInstance() @@ -70,7 +71,7 @@ fun OfflinePlayer.getAverageSkillLevel(): Double { } fun Player.giveSkillExperience(skill: Skill, experience: Double, noMultiply: Boolean = false) { - val exp = if (noMultiply) experience else experience * this.getSkillExperienceMultiplier() + val exp = abs(if (noMultiply) experience else experience * this.getSkillExperienceMultiplier()) val gainEvent = PlayerSkillExpGainEvent(this, skill, exp) Bukkit.getPluginManager().callEvent(gainEvent)