Skip to content

Commit

Permalink
Fixed ProvidedHolderConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Apr 30, 2023
1 parent 1c60f33 commit f1b7c0f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.willfp.libreforge

import com.willfp.eco.core.config.interfaces.Config
import com.willfp.eco.core.placeholder.context.PlaceholderContext
import com.willfp.eco.core.placeholder.context.copy
import com.willfp.eco.util.NumberUtils
import com.willfp.eco.util.formatEco
import org.bukkit.inventory.ItemStack
Expand All @@ -18,18 +19,18 @@ private class ProvidedHolderConfig(
override fun getDoubleFromExpression(path: String, context: PlaceholderContext): Double {
return NumberUtils.evaluateExpression(
this.getString(path),
context.copyWithItem(holder.provider as? ItemStack)
context.withInjectableContext(config).copy(item = holder.provider as? ItemStack)
)
}

override fun getFormattedStringOrNull(path: String, context: PlaceholderContext): String? {
val string = this.getStringOrNull(path) ?: return null
return string.formatEco(context.copyWithItem(holder.provider as? ItemStack))
return string.formatEco(context.withInjectableContext(config).copy(item = holder.provider as? ItemStack))
}

override fun getFormattedStringsOrNull(path: String, context: PlaceholderContext): List<String>? {
val strings = this.getStringsOrNull(path) ?: return null
return strings.formatEco(context.copyWithItem(holder.provider as? ItemStack))
return strings.formatEco(context.withInjectableContext(config).copy(item = holder.provider as? ItemStack))
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = 4.7.0
version = 4.7.1
kotlin.code.style = official

0 comments on commit f1b7c0f

Please sign in to comment.