mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-08-28 08:25:56 +02:00
add unit repair to item config
This commit is contained in:
parent
6178282386
commit
bc9ac1cc13
3 changed files with 22 additions and 9 deletions
|
|
@ -25,7 +25,7 @@ object UnitRepairUtil {
|
|||
if (other == null) return null
|
||||
val config = ConfigHolder.UNIT_REPAIR_HOLDER.config
|
||||
|
||||
val result = findRepairValue(this, other, config) ?: return null
|
||||
val result = findRawRepairValue(this, other, config) ?: return null
|
||||
|
||||
if(result > 0) return result
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ object UnitRepairUtil {
|
|||
return userDefault
|
||||
}
|
||||
|
||||
private fun findRepairValue(
|
||||
private fun findRawRepairValue(
|
||||
self: ItemStack,
|
||||
other: ItemStack,
|
||||
config: FileConfiguration
|
||||
|
|
@ -50,6 +50,17 @@ object UnitRepairUtil {
|
|||
return checkSection(config, material.key, selfType)
|
||||
}
|
||||
|
||||
fun findRawRepairValue(
|
||||
self: NamespacedKey,
|
||||
other: NamespacedKey,
|
||||
config: FileConfiguration
|
||||
): Double? {
|
||||
val result = checkSection(config, other.toString(), self)
|
||||
if (result != null) return result
|
||||
|
||||
return checkSection(config, other.key, self)
|
||||
}
|
||||
|
||||
fun checkSection(
|
||||
config: FileConfiguration,
|
||||
path: String,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue