mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-08-28 08:25:56 +02:00
fix using durability for max damage
Some checks are pending
Java CI with Gradle / build (push) Waiting to run
Some checks are pending
Java CI with Gradle / build (push) Waiting to run
This commit is contained in:
parent
403c990083
commit
16e4f0a923
2 changed files with 21 additions and 21 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue