mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
fix multiples issues
This commit is contained in:
parent
2768c0a0dc
commit
bf4395ba3f
7 changed files with 24 additions and 8 deletions
|
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ object AnvilXpUtil {
|
|||
|
||||
override fun asMonetaryCost(): BigDecimal {
|
||||
return BigDecimal(rawCost)
|
||||
.multiply(moneyMultiplier("global"))
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue