mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
Made unit repair test lower first.
Default config and creation use lowercase by default. testing lowercase first is a small improvement of performances.
This commit is contained in:
parent
b53d347221
commit
e43f6276cd
1 changed files with 5 additions and 5 deletions
|
|
@ -22,10 +22,10 @@ object UnitRepairUtil {
|
||||||
if (other == null) return null
|
if (other == null) return null
|
||||||
val config = ConfigHolder.UNIT_REPAIR_HOLDER.config
|
val config = ConfigHolder.UNIT_REPAIR_HOLDER.config
|
||||||
// Get configuration section if exist
|
// Get configuration section if exist
|
||||||
val otherName = other.type.name.uppercase()
|
val otherName = other.type.name.lowercase()
|
||||||
var section = config.getConfigurationSection(otherName)
|
var section = config.getConfigurationSection(otherName)
|
||||||
if (section == null) {
|
if (section == null) {
|
||||||
section = config.getConfigurationSection(otherName.lowercase())
|
section = config.getConfigurationSection(otherName.uppercase())
|
||||||
if (section == null) return null
|
if (section == null) return null
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -44,11 +44,11 @@ object UnitRepairUtil {
|
||||||
* If value is set to less than or equal to 0 then it will be set to default
|
* If value is set to less than or equal to 0 then it will be set to default
|
||||||
*/
|
*/
|
||||||
private fun getRepairAmount(item: ItemStack, section: ConfigurationSection, default: Double): Double? {
|
private fun getRepairAmount(item: ItemStack, section: ConfigurationSection, default: Double): Double? {
|
||||||
val itemName = item.type.name.uppercase()
|
val itemName = item.type.name.lowercase()
|
||||||
val repairValue = if (section.isDouble(itemName)) {
|
val repairValue = if (section.isDouble(itemName)) {
|
||||||
section.getDouble(itemName)
|
section.getDouble(itemName)
|
||||||
} else if (section.isDouble(itemName.lowercase())) {
|
} else if (section.isDouble(itemName.uppercase())) {
|
||||||
section.getDouble(itemName.lowercase())
|
section.getDouble(itemName.uppercase())
|
||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue