mirror of
https://github.com/Auxilor/EcoSkills.git
synced 2025-12-31 12:56:31 +00:00
Fixed rewards messages
This commit is contained in:
@@ -80,8 +80,6 @@ class Skill(
|
||||
ViolationContext(plugin, "Skill $id level-up-effects")
|
||||
)
|
||||
|
||||
private val rewardMessages = mutableMapOf<Int, List<String>>()
|
||||
|
||||
val levelGUI = SkillLevelGUI(plugin, this)
|
||||
|
||||
val icon = SkillIcon(this, config.getSubsection("gui"), plugin)
|
||||
@@ -174,7 +172,7 @@ class Skill(
|
||||
val margin = s.length - s.trimStart().length
|
||||
|
||||
if (s.contains("%rewards%")) {
|
||||
getRewardMessages(level)
|
||||
getRewardMessages(level, player)
|
||||
.addMargin(margin)
|
||||
} else if (s.contains("%gui_lore%")) {
|
||||
config.getStrings("gui.lore")
|
||||
@@ -216,8 +214,14 @@ class Skill(
|
||||
* Get the reward messages for a certain [level].
|
||||
*/
|
||||
private fun getRewardMessages(
|
||||
level: Int
|
||||
): List<String> = rewardMessages.getOrPut(level) {
|
||||
level: Int,
|
||||
player: Player
|
||||
): List<String> {
|
||||
val context = placeholderContext(
|
||||
injectable = LevelInjectable(level),
|
||||
player = player
|
||||
)
|
||||
|
||||
// Determine the highest level of messages from the config that is not greater than the provided level.
|
||||
val highestConfiguredLevel = config.getSubsection("reward-messages")
|
||||
.getKeys(false)
|
||||
@@ -227,10 +231,6 @@ class Skill(
|
||||
|
||||
val messages = config.getStrings("reward-messages.$highestConfiguredLevel").toMutableList()
|
||||
|
||||
val context = placeholderContext(
|
||||
injectable = LevelInjectable(level)
|
||||
)
|
||||
|
||||
for (placeholder in loadDescriptionPlaceholders(config)) {
|
||||
val id = placeholder.id
|
||||
val value = evaluateExpression(placeholder.expr, context)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#libreforge-updater
|
||||
#Thu Jun 01 12:33:09 BST 2023
|
||||
kotlin.code.style=official
|
||||
libreforge-version=4.17.1
|
||||
libreforge-version=4.17.2
|
||||
version=3.3.1
|
||||
|
||||
Reference in New Issue
Block a user