fix using durability for max damage
Some checks are pending
Java CI with Gradle / build (push) Waiting to run

This commit is contained in:
alexcrea 2026-07-08 04:22:59 +02:00
parent 403c990083
commit 16e4f0a923
Signed by: alexcrea
GPG key ID: E59DF23EE2A2266C
2 changed files with 21 additions and 21 deletions

View file

@ -1,5 +1,6 @@
package xyz.alexcrea.cuanvil.util
import org.bukkit.Material
import org.bukkit.inventory.meta.Damageable
// I LOVE support of old versions and needing to do modules like that
@ -10,8 +11,8 @@ object MaxDamageCheckerUtil {
/**
* @return max damage or int max if not set
*/
fun getMaxDamage(meta: Damageable): Int {
if(!meta.hasMaxDamage()) return Integer.MAX_VALUE
fun getMaxDamage(type: Material, meta: Damageable): Int {
if(!meta.hasMaxDamage()) return type.maxDurability.toInt()
return meta.maxDamage
}