diff --git a/defaultconfigs/1.18/config.yml b/defaultconfigs/1.18/config.yml index fb70505..b5ad3b0 100644 --- a/defaultconfigs/1.18/config.yml +++ b/defaultconfigs/1.18/config.yml @@ -436,7 +436,10 @@ lore_edit: # It also requires to enable dialog rename (set "enable_dialog_rename: false" a bit higher) # If dialog rename permission is enabled and player do not have the permission merge will fall back to vanilla xp cost # -# As this feature require dialog rename, it can only be enabled starting with paper 1.21.6 +# If you are using custom craft I recommend using Linear Xp Cost with Exact Linear Xp as normal Xp Cost will act "weird" +# But Linear Xp will act as 1$ time global multiplier. In other word: like you expect +# +# As this feature require dialog rename, it can only be enabled starting with paper 1.21.6 and later monetary_cost: enabled: false # If using vault unlocked this allow to specify what currency should be used for anvil usage diff --git a/defaultconfigs/1.21.11/config.yml b/defaultconfigs/1.21.11/config.yml index b70798c..44885b7 100644 --- a/defaultconfigs/1.21.11/config.yml +++ b/defaultconfigs/1.21.11/config.yml @@ -456,7 +456,10 @@ lore_edit: # It also requires to enable dialog rename (set "enable_dialog_rename: false" a bit higher) # If dialog rename permission is enabled and player do not have the permission merge will fall back to vanilla xp cost # -# As this feature require dialog rename, it can only be enabled starting with paper 1.21.6 +# If you are using custom craft I recommend using Linear Xp Cost with Exact Linear Xp as normal Xp Cost will act "weird" +# But Linear Xp will act as 1$ time global multiplier. In other word: like you expect +# +# As this feature require dialog rename, it can only be enabled starting with paper 1.21.6 and later monetary_cost: enabled: false # If using vault unlocked this allow to specify what currency should be used for anvil usage diff --git a/defaultconfigs/1.21.9/config.yml b/defaultconfigs/1.21.9/config.yml index 31bdb1f..4df5876 100644 --- a/defaultconfigs/1.21.9/config.yml +++ b/defaultconfigs/1.21.9/config.yml @@ -448,7 +448,10 @@ lore_edit: # It also requires to enable dialog rename (set "enable_dialog_rename: false" a bit higher) # If dialog rename permission is enabled and player do not have the permission merge will fall back to vanilla xp cost # -# As this feature require dialog rename, it can only be enabled starting with paper 1.21.6 +# If you are using custom craft I recommend using Linear Xp Cost with Exact Linear Xp as normal Xp Cost will act "weird" +# But Linear Xp will act as 1$ time global multiplier. In other word: like you expect +# +# As this feature require dialog rename, it can only be enabled starting with paper 1.21.6 and later monetary_cost: enabled: false # If using vault unlocked this allow to specify what currency should be used for anvil usage diff --git a/defaultconfigs/1.21/config.yml b/defaultconfigs/1.21/config.yml index 1dafa54..5d59e5a 100644 --- a/defaultconfigs/1.21/config.yml +++ b/defaultconfigs/1.21/config.yml @@ -436,7 +436,10 @@ lore_edit: # It also requires to enable dialog rename (set "enable_dialog_rename: false" a bit higher) # If dialog rename permission is enabled and player do not have the permission merge will fall back to vanilla xp cost # -# As this feature require dialog rename, it can only be enabled starting with paper 1.21.6 +# If you are using custom craft I recommend using Linear Xp Cost with Exact Linear Xp as normal Xp Cost will act "weird" +# But Linear Xp will act as 1$ time global multiplier. In other word: like you expect +# +# As this feature require dialog rename, it can only be enabled starting with paper 1.21.6 and later monetary_cost: enabled: false # If using vault unlocked this allow to specify what currency should be used for anvil usage diff --git a/src/main/kotlin/xyz/alexcrea/cuanvil/listener/AnvilResultListener.kt b/src/main/kotlin/xyz/alexcrea/cuanvil/listener/AnvilResultListener.kt index 549fd9a..6b5f510 100644 --- a/src/main/kotlin/xyz/alexcrea/cuanvil/listener/AnvilResultListener.kt +++ b/src/main/kotlin/xyz/alexcrea/cuanvil/listener/AnvilResultListener.kt @@ -160,7 +160,7 @@ class AnvilResultListener : Listener { if (player.gameMode != GameMode.CREATIVE) { if(ConfigOptions.shouldUseMoney(player)) { result.cost.isMonetary = true - if(!EconomyManager.economy!!.has(player, BigDecimal(rawCost))) return + if(!EconomyManager.economy!!.has(player, result.cost.asMonetaryCost())) return } else if (recipe.removeExactLinearXp) { val levelXp = AnvilXpUtil.calculateXpForLevel(player.level) val delta = AnvilXpUtil.calculateXpForLevel(player.level + 1) - levelXp @@ -243,7 +243,7 @@ class AnvilResultListener : Listener { val rawCost = result.customCraftCost.rawCost if(result.cost.isMonetary) { - EconomyManager.economy!!.remove(player, BigDecimal(rawCost)) + EconomyManager.economy!!.remove(player, result.cost.asMonetaryCost()) return } @@ -262,7 +262,7 @@ class AnvilResultListener : Listener { player.level = newLevel player.exp = xp / newDelta } else { - player.level -= rawCost + player.level -= AnvilXpUtil.calculateLevelForXp(rawCost) } } diff --git a/src/main/kotlin/xyz/alexcrea/cuanvil/util/anvil/AnvilXpUtil.kt b/src/main/kotlin/xyz/alexcrea/cuanvil/util/anvil/AnvilXpUtil.kt index b57a696..8c39a0a 100644 --- a/src/main/kotlin/xyz/alexcrea/cuanvil/util/anvil/AnvilXpUtil.kt +++ b/src/main/kotlin/xyz/alexcrea/cuanvil/util/anvil/AnvilXpUtil.kt @@ -75,6 +75,7 @@ object AnvilXpUtil { override fun asMonetaryCost(): BigDecimal { return BigDecimal(rawCost) + .multiply(moneyMultiplier("global")) } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 27c0248..7d6e396 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -438,7 +438,10 @@ lore_edit: # It also requires to enable dialog rename (set "enable_dialog_rename: false" a bit higher) # If dialog rename permission is enabled and player do not have the permission merge will fall back to vanilla xp cost # -# As this feature require dialog rename, it can only be enabled starting with paper 1.21.6 +# If you are using custom craft I recommend using Linear Xp Cost with Exact Linear Xp as normal Xp Cost will act "weird" +# But Linear Xp will act as 1$ time global multiplier. In other word: like you expect +# +# As this feature require dialog rename, it can only be enabled starting with paper 1.21.6 and later monetary_cost: enabled: false # If using vault unlocked this allow to specify what currency should be used for anvil usage