mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
add config for xp formula and version up. also moved logo cause it is useless inside the plugin
This commit is contained in:
parent
87b8738c6e
commit
5bc1d8b737
6 changed files with 50 additions and 6 deletions
|
|
@ -66,7 +66,7 @@ class AnvilEventListener : Listener {
|
|||
resultItem.itemMeta?.let {
|
||||
if(!it.displayName.contentEquals(inventory.renameText)){
|
||||
it.setDisplayName(inventory.renameText)
|
||||
anvilCost += 1
|
||||
anvilCost += ConfigOptions.itemRepairCost
|
||||
}
|
||||
resultItem.itemMeta = it
|
||||
}
|
||||
|
|
@ -135,8 +135,7 @@ class AnvilEventListener : Listener {
|
|||
)){
|
||||
// There may an issue when illegal enchant are trying to combine
|
||||
// at least that what I think, but can't find why
|
||||
illegalPenalty++
|
||||
UnsafeEnchants.log("Conflict for ${enchantment.key.enchantmentName}, add 1 of value")
|
||||
illegalPenalty += ConfigOptions.sacrificeIllegalCost
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@ object ConfigOptions {
|
|||
private const val LIMIT_REPAIR_COST = "limit_repair_cost"
|
||||
// Path for repair value limit
|
||||
private const val LIMIT_REPAIR_VALUE = "limit_repair_value"
|
||||
// Path for level cost on item repair
|
||||
private const val ITEM_REPAIR_COST = "item_repair_cost"
|
||||
// Path for level cost on illegal enchantment on sacrifice
|
||||
private const val SACRIFICE_ILLEGAL_COST = "sacrifice_illegal_enchant_cost"
|
||||
// Path for removing repair cost limits
|
||||
private const val REMOVE_REPAIR_LIMIT = "remove_repair_limit"
|
||||
// Root path for enchantment limits
|
||||
|
|
@ -30,15 +34,23 @@ object ConfigOptions {
|
|||
private const val DEBUG_LOGGING = "debug_log"
|
||||
|
||||
// Default value for enchantment limits
|
||||
private const val DEFAULT_ENCHANT_LIMIT = 10
|
||||
private const val DEFAULT_ENCHANT_LIMIT = 5
|
||||
// Default value for allowing unsafe enchantments
|
||||
private const val DEFAULT_ALLOW_UNSAFE = true
|
||||
// Default value for limiting repair cost
|
||||
private const val DEFAULT_LIMIT_REPAIR = true
|
||||
// Default value for repair cost limit
|
||||
private const val DEFAULT_LIMIT_REPAIR_VALUE = 39
|
||||
// Default value for level cost on item repair
|
||||
private const val DEFAULT_ITEM_REPAIR_COST = 2
|
||||
// Default value for level cost on illegal enchantment on sacrifice
|
||||
private const val DEFAULT_SACRIFICE_ILLEGAL_COST = 1
|
||||
// Valid range for repair cost limit
|
||||
private val REPAIR_LIMIT_RANGE = 1..39
|
||||
// Valid range for repair cost limit
|
||||
private val ITEM_REPAIR_COST_RANGE = 0..255
|
||||
// Valid range for repair cost limit
|
||||
private val SACRIFICE_ILLEGAL_COST_RANGE = 0..255
|
||||
// Default for removing repair cost limits
|
||||
private const val DEFAULT_REMOVE_LIMIT = false
|
||||
// Valid range for an enchantment limit
|
||||
|
|
@ -90,6 +102,29 @@ object ConfigOptions {
|
|||
?: DEFAULT_LIMIT_REPAIR_VALUE
|
||||
}
|
||||
|
||||
/**
|
||||
* Value to limit repair costs to
|
||||
*/
|
||||
val itemRepairCost: Int
|
||||
get() {
|
||||
return UnsafeEnchants.instance
|
||||
.config
|
||||
.getInt(ITEM_REPAIR_COST, DEFAULT_ITEM_REPAIR_COST)
|
||||
.takeIf { it in ITEM_REPAIR_COST_RANGE }
|
||||
?: DEFAULT_ITEM_REPAIR_COST
|
||||
}
|
||||
|
||||
/**
|
||||
* Value to limit repair costs to
|
||||
*/
|
||||
val sacrificeIllegalCost: Int
|
||||
get() {
|
||||
return UnsafeEnchants.instance
|
||||
.config
|
||||
.getInt(SACRIFICE_ILLEGAL_COST, DEFAULT_SACRIFICE_ILLEGAL_COST)
|
||||
.takeIf { it in SACRIFICE_ILLEGAL_COST_RANGE }
|
||||
?: DEFAULT_SACRIFICE_ILLEGAL_COST
|
||||
}
|
||||
/**
|
||||
* Whether to remove repair cost limit
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -22,6 +22,16 @@ limit_repair_cost: true
|
|||
# Valid range of 1 - 39 (vanilla will consider 40+ as "too expensive")
|
||||
limit_repair_value: 39
|
||||
|
||||
# Value added to the anvil when the item durability increase
|
||||
#
|
||||
# Valid range of 0 - 255
|
||||
item_repair_cost: 2
|
||||
|
||||
# Value added to the anvil when the sacrifice try to add illegal enchant to the item
|
||||
#
|
||||
# Valid range of 0 - 255
|
||||
sacrifice_illegal_enchant_cost: 1
|
||||
|
||||
# Whether the anvil's repair limit should be removed entirely
|
||||
#
|
||||
# The anvil will still visually display "too expensive" however the action will be completable
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 58 KiB |
|
|
@ -1,7 +1,7 @@
|
|||
main: io.delilaheve.UnsafeEnchants
|
||||
name: UnsafeEnchantsPlus
|
||||
prefix: UnsafeEnchants+
|
||||
version: 1.1.2
|
||||
version: 1.1.3
|
||||
description: Allow custom illegal enchantment
|
||||
api-version: 1.18
|
||||
load: POSTWORLD
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue