From 4e541807fc7ef7793d5e040d474cecf28f50fcfc Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sun, 17 Apr 2022 13:01:03 +0100 Subject: [PATCH] Added %weight% and %actual_weight% as reward placeholders --- .../src/main/kotlin/com/willfp/ecocrates/reward/Reward.kt | 8 +++++++- eco-core/core-plugin/src/main/resources/rewards.yml | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecocrates/reward/Reward.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecocrates/reward/Reward.kt index 1070ac8..93a39d7 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecocrates/reward/Reward.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecocrates/reward/Reward.kt @@ -21,7 +21,7 @@ import org.bukkit.Material import org.bukkit.OfflinePlayer import org.bukkit.entity.Player import org.bukkit.inventory.ItemStack -import java.util.* +import java.util.Objects class Reward( private val plugin: EcoPlugin, @@ -64,6 +64,12 @@ class Reward( ).replace( "%actual_chance%", getPercentageChance(player, crate.rewards, displayWeight = false).toNiceString() + ).replace( + "%weight%", + this.getDisplayWeight(player).toNiceString() + ).replace( + "%actual_weight%", + this.getWeight(player).toNiceString() ).formatEco(player) } return item diff --git a/eco-core/core-plugin/src/main/resources/rewards.yml b/eco-core/core-plugin/src/main/resources/rewards.yml index 3a23165..d6c2dc8 100644 --- a/eco-core/core-plugin/src/main/resources/rewards.yml +++ b/eco-core/core-plugin/src/main/resources/rewards.yml @@ -12,7 +12,7 @@ rewards: display: # The display item shown in animations and GUIs name: "&bDiamond Sword" # The item name item: diamond_sword sharpness:5 unbreaking:3 # The shown item - lore: # Can use %chance% and %actual_chance% as placeholders + lore: # Can use %chance%, %actual_chance%, %weight%, and %actual_weight% as placeholders - "&fDisplay Chance: &a%chance%%" - "&fActual Chance: &a%actual_chance%%"