9
0
mirror of https://github.com/Auxilor/EcoSkills.git synced 2026-01-06 15:51:52 +00:00

Fixed ferocity overflow

This commit is contained in:
Auxilor
2021-08-23 01:32:24 +01:00
parent 254d51de51
commit 04d8a9a73d
2 changed files with 12 additions and 2 deletions

View File

@@ -159,6 +159,11 @@ abstract class Skill(
}
fun getExpForLevel(level: Int): Int {
return this.plugin.configYml.getInts("skills.level-xp-requirements")[level - 1] ?: Integer.MAX_VALUE
val req = this.plugin.configYml.getInts("skills.level-xp-requirements")
return if (req.size <= level) {
Int.MAX_VALUE
} else {
req[level - 1]
}
}
}

View File

@@ -21,6 +21,10 @@ class StatFerocity : Stat(
val victim = event.entity
val entity = event.damager
if (victim.hasMetadata("ferocity")) {
return
}
if (victim !is LivingEntity) {
return
}
@@ -44,8 +48,9 @@ class StatFerocity : Stat(
}
this.plugin.run {
victim.setMetadata("ferocity", plugin.metadataValueFactory.create(true))
victim.noDamageTicks = 0
victim.damage(event.finalDamage, entity)
victim.damage(event.damage, entity)
}
}
}