mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 08:14:00 +02:00
monetary minimum version & rename impl
This commit is contained in:
parent
1660250ee1
commit
ac9f492125
7 changed files with 34 additions and 4 deletions
|
|
@ -432,6 +432,8 @@ lore_edit:
|
|||
|
||||
# Allow to replace the xp cost by a monetary cost
|
||||
# If enabled it will not be bound to the experience level limits
|
||||
#
|
||||
# This feature can only be enabled starting with 1.21
|
||||
monetary_cost:
|
||||
enabled: false
|
||||
# If using vault unlocked this allow to specify what currency should be used for anvil usage
|
||||
|
|
|
|||
|
|
@ -452,6 +452,8 @@ lore_edit:
|
|||
|
||||
# Allow to replace the xp cost by a monetary cost
|
||||
# If enabled it will not be bound to the experience level limits
|
||||
#
|
||||
# This feature can only be enabled starting with 1.21
|
||||
monetary_cost:
|
||||
enabled: false
|
||||
# If using vault unlocked this allow to specify what currency should be used for anvil usage
|
||||
|
|
|
|||
|
|
@ -444,6 +444,8 @@ lore_edit:
|
|||
|
||||
# Allow to replace the xp cost by a monetary cost
|
||||
# If enabled it will not be bound to the experience level limits
|
||||
#
|
||||
# This feature can only be enabled starting with 1.21
|
||||
monetary_cost:
|
||||
enabled: false
|
||||
# If using vault unlocked this allow to specify what currency should be used for anvil usage
|
||||
|
|
|
|||
|
|
@ -432,6 +432,8 @@ lore_edit:
|
|||
|
||||
# Allow to replace the xp cost by a monetary cost
|
||||
# If enabled it will not be bound to the experience level limits
|
||||
#
|
||||
# This feature can only be enabled starting with 1.21
|
||||
monetary_cost:
|
||||
enabled: false
|
||||
# If using vault unlocked this allow to specify what currency should be used for anvil usage
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
package xyz.alexcrea.cuanvil.util
|
||||
|
||||
import org.bukkit.inventory.InventoryView
|
||||
|
||||
// TODO yet another cleanup to do on legacy removal branch
|
||||
object RenameAnvilUtil {
|
||||
|
||||
fun rename(view: InventoryView, name: String) {
|
||||
view.title = name
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -9,7 +9,10 @@ import xyz.alexcrea.cuanvil.config.WorkPenaltyType.WorkPenaltyPart
|
|||
import xyz.alexcrea.cuanvil.dependency.DependencyManager
|
||||
import xyz.alexcrea.cuanvil.dependency.economy.EconomyManager
|
||||
import xyz.alexcrea.cuanvil.enchant.CAEnchantment
|
||||
import xyz.alexcrea.cuanvil.update.UpdateUtils
|
||||
import xyz.alexcrea.cuanvil.update.Version
|
||||
import xyz.alexcrea.cuanvil.util.AnvilUseType
|
||||
import java.math.BigDecimal
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
|
|
@ -87,6 +90,9 @@ object ConfigOptions {
|
|||
const val DEBUG_LOGGING = "debug_log"
|
||||
const val VERBOSE_DEBUG_LOGGING = "debug_log_verbose"
|
||||
|
||||
// Minimum versions
|
||||
val MINIMUM_MONETARY_COST_VER = Version(21, 0, 0)
|
||||
|
||||
// ----------------------
|
||||
// Default config values
|
||||
// ----------------------
|
||||
|
|
@ -637,11 +643,12 @@ object ConfigOptions {
|
|||
}
|
||||
|
||||
/*
|
||||
* Monetary configs
|
||||
* Monetary configs (only for 1.21+)
|
||||
*/
|
||||
val shouldUseMoney: Boolean
|
||||
get() {
|
||||
return EconomyManager.economy?.initialized() == true &&
|
||||
UpdateUtils.currentMinecraftVersion().greaterEqual(MINIMUM_MONETARY_COST_VER) &&
|
||||
ConfigHolder.DEFAULT_CONFIG
|
||||
.config
|
||||
.getBoolean(SHOULD_USE_MONEY, DEFAULT_SHOULD_USE_MONEY)
|
||||
|
|
@ -654,10 +661,10 @@ object ConfigOptions {
|
|||
.getString(MONEY_CURRENCY, DEFAULT_MONEY_CURRENCY)!!
|
||||
}
|
||||
|
||||
fun getMonetaryMultiplier(type: String): Double {
|
||||
return ConfigHolder.DEFAULT_CONFIG
|
||||
fun getMonetaryMultiplier(type: String): BigDecimal {
|
||||
return BigDecimal(ConfigHolder.DEFAULT_CONFIG
|
||||
.config
|
||||
.getDouble("$MONETARY_MULTIPLIER_ROOT.$type", DEFAULT_MONEY_MULTIPLIER)
|
||||
.getDouble("$MONETARY_MULTIPLIER_ROOT.$type", DEFAULT_MONEY_MULTIPLIER))
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -434,6 +434,8 @@ lore_edit:
|
|||
|
||||
# Allow to replace the xp cost by a monetary cost
|
||||
# If enabled it will not be bound to the experience level limits
|
||||
#
|
||||
# This feature can only be enabled starting with 1.21
|
||||
monetary_cost:
|
||||
enabled: false
|
||||
# If using vault unlocked this allow to specify what currency should be used for anvil usage
|
||||
|
|
@ -448,6 +450,7 @@ monetary_cost:
|
|||
repair: 1.0 # for repairing via unit repair (per unit)
|
||||
rename: 1.0 # for renaming the item
|
||||
lore_edit: 1.0 # for changing the lore of the item (only if lore edit is enabled)
|
||||
illegal_penalty: 1.0 # for trying to combine illegal enchantment
|
||||
work_penalty: 1.0 # for work penalty (aka use penalty)
|
||||
recipe: 1.0 # for custom anvil recipe cost
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue