Moved some and added more config

This commit is contained in:
alexcrea 2025-03-10 13:54:37 +01:00
parent 78e4ffd0c6
commit 3f15143c2b
No known key found for this signature in database
GPG key ID: 43FD265DB0DBF91F
9 changed files with 519 additions and 156 deletions

View file

@ -6,6 +6,7 @@ import org.jetbrains.annotations.NotNull;
import xyz.alexcrea.cuanvil.config.ConfigHolder;
import static io.delilaheve.util.ConfigOptions.*;
import static xyz.alexcrea.cuanvil.util.config.LoreEditConfigUtil.*;
public class PluginSetDefault {
@ -28,7 +29,8 @@ public class PluginSetDefault {
nbSet+= trySetDefault(config, USE_OF_COLOR_COST, DEFAULT_USE_OF_COLOR_COST);
nbSet+= trySetDefault(config, DEFAULT_LIMIT_PATH, DEFAULT_ENCHANT_LIMIT);
nbSet+= trySetDefault(config, APPEND_LORE_BOOK_AND_QUIL, DEFAULT_APPEND_LORE_BOOK_AND_QUIL);
// TODO rework lore edit defaults
/*nbSet+= trySetDefault(config, APPEND_LORE_BOOK_AND_QUIL, DEFAULT_APPEND_LORE_BOOK_AND_QUIL);
nbSet+= trySetDefault(config, APPEND_LORE_LINE_PAPER, DEFAULT_APPEND_LORE_LINE_PAPER);
nbSet+= trySetDefault(config, REMOVE_LORE_BOOK_AND_QUIL, DEFAULT_REMOVE_LORE_BOOK_AND_QUIL);
@ -36,7 +38,7 @@ public class PluginSetDefault {
nbSet+= trySetDefault(config, LORE_LINE_WITH_PAPER_ORDER, DEFAULT_LORE_LINE_WITH_PAPER_ORDER);
nbSet+= trySetDefault(config, EDIT_LORE_WITH_BOOK_NEED_PERMISSION, DEFAULT_EDIT_LORE_WITH_BOOK_NEED_PERMISSION);
nbSet+= trySetDefault(config, EDIT_LORE_WITH_PAPER_NEED_PERMISSION, DEFAULT_EDIT_LORE_WITH_PAPER_NEED_PERMISSION);
nbSet+= trySetDefault(config, EDIT_LORE_WITH_PAPER_NEED_PERMISSION, DEFAULT_EDIT_LORE_WITH_PAPER_NEED_PERMISSION);*/
if(nbSet > 0){
CustomAnvil.instance.getLogger().info("Adding " + nbSet + " absent default config values.");

View file

@ -7,7 +7,7 @@ import xyz.alexcrea.cuanvil.config.WorkPenaltyType
import xyz.alexcrea.cuanvil.config.WorkPenaltyType.WorkPenaltyPart
import xyz.alexcrea.cuanvil.enchant.CAEnchantment
import xyz.alexcrea.cuanvil.util.AnvilUseType
import java.util.EnumMap
import java.util.*
/**
* Config option accessors
@ -51,17 +51,6 @@ object ConfigOptions {
const val DISABLE_MERGE_OVER_ROOT = "disable-merge-over"
// Lore edit configs
const val APPEND_LORE_BOOK_AND_QUIL = "lore_edit.book_and_quil.append"
const val REMOVE_LORE_BOOK_AND_QUIL = "lore_edit.book_and_quil.remove"
const val APPEND_LORE_LINE_PAPER = "lore_edit.paper.append_line"
const val REMOVE_LORE_LINE_PAPER = "lore_edit.paper.remove_line"
const val LORE_LINE_WITH_PAPER_ORDER = "lore_edit.paper.order"
const val EDIT_LORE_WITH_BOOK_NEED_PERMISSION = "lore_edit.book_and_quil.use_permission"
const val EDIT_LORE_WITH_PAPER_NEED_PERMISSION = "lore_edit.paper.use_permission"
// Keys for specific enchantment values
private const val KEY_BOOK = "book"
private const val KEY_ITEM = "item"
@ -95,17 +84,6 @@ object ConfigOptions {
const val DEFAULT_ENCHANT_LIMIT = 5
// lore edit config
const val DEFAULT_APPEND_LORE_BOOK_AND_QUIL = false
const val DEFAULT_REMOVE_LORE_BOOK_AND_QUIL = false
const val DEFAULT_APPEND_LORE_LINE_PAPER = false
const val DEFAULT_REMOVE_LORE_LINE_PAPER = false
const val DEFAULT_LORE_LINE_WITH_PAPER_ORDER = "end"
const val DEFAULT_EDIT_LORE_WITH_BOOK_NEED_PERMISSION = true
const val DEFAULT_EDIT_LORE_WITH_PAPER_NEED_PERMISSION = true
// Debug flag
private const val DEFAULT_DEBUG_LOG = false
private const val DEFAULT_VERBOSE_DEBUG_LOG = false
@ -138,6 +116,9 @@ object ConfigOptions {
@JvmField
val ENCHANT_LIMIT_RANGE = 1..255
// --------------
// Other defaults
// --------------
// Default value for an enchantment multiplier
private const val DEFAULT_ENCHANT_VALUE = 0
@ -262,7 +243,10 @@ object ConfigOptions {
/**
* If one of the color component is enabled
*/
val renameColorPossible: Boolean get() { return allowColorCode || allowHexadecimalColor }
val renameColorPossible: Boolean
get() {
return allowColorCode || allowHexadecimalColor
}
/**
* If players need a permission to use color
@ -313,8 +297,10 @@ object ConfigOptions {
val penaltyIncrease = section.getBoolean(WORK_PENALTY_INCREASE, defaultPenalty.penaltyIncrease)
val penaltyAdditive = section.getBoolean(WORK_PENALTY_ADDITIVE, defaultPenalty.penaltyAdditive)
val exclusivePenaltyIncrease = section.getBoolean(EXCLUSIVE_WORK_PENALTY_INCREASE, defaultPenalty.exclusivePenaltyIncrease)
val exclusivePenaltyAdditive = section.getBoolean(EXCLUSIVE_WORK_PENALTY_ADDITIVE, defaultPenalty.exclusivePenaltyAdditive)
val exclusivePenaltyIncrease =
section.getBoolean(EXCLUSIVE_WORK_PENALTY_INCREASE, defaultPenalty.exclusivePenaltyIncrease)
val exclusivePenaltyAdditive =
section.getBoolean(EXCLUSIVE_WORK_PENALTY_ADDITIVE, defaultPenalty.exclusivePenaltyAdditive)
return WorkPenaltyPart(penaltyIncrease, penaltyAdditive, exclusivePenaltyIncrease, exclusivePenaltyAdditive)
}
@ -355,11 +341,11 @@ object ConfigOptions {
fun enchantLimit(enchantment: CAEnchantment): Int {
// Test namespace
var limit = enchantLimit(enchantment.key.toString())
if(limit != null) return limit
if (limit != null) return limit
// Test legacy (name only)
limit = enchantLimit(enchantment.enchantmentName)
if(limit != null) return limit
if (limit != null) return limit
// get default (and test old legacy if present)
return getDefaultLevel(enchantment.enchantmentName)
@ -373,18 +359,19 @@ object ConfigOptions {
val path = "${ENCHANT_LIMIT_ROOT}.$enchantmentName"
return CustomAnvil.instance
.config
.getInt(path, ENCHANT_LIMIT_RANGE.first-1)
.getInt(path, ENCHANT_LIMIT_RANGE.first - 1)
.takeIf { it in ENCHANT_LIMIT_RANGE }
}
/**
* Get default value if enchantment do not exist on config
*/
private fun getDefaultLevel(enchantmentName: String, // compatibility with 1.20.5. TODO better update system
) : Int {
if(enchantmentName == "sweeping_edge"){
val limit = enchantLimit("sweeping")
if(limit != null) return limit
private fun getDefaultLevel(
enchantmentName: String, // compatibility with 1.20.5. TODO better update system
): Int {
if (enchantmentName == "sweeping_edge") {
val limit = enchantLimit("sweeping")
if (limit != null) return limit
}
return defaultEnchantLimit
@ -400,11 +387,11 @@ object ConfigOptions {
): Int {
// Test namespace
var limit = enchantmentValue(enchantment.key.toString(), isFromBook)
if(limit != null) return limit
if (limit != null) return limit
// Test legacy (name only)
limit = enchantmentValue(enchantment.enchantmentName, isFromBook)
if(limit != null) return limit
if (limit != null) return limit
// get default (and test old legacy if present)
return getDefaultValue(enchantment, isFromBook)
@ -430,21 +417,23 @@ object ConfigOptions {
/**
* Get default value if enchantment do not exist on config
*/
private fun getDefaultValue(enchantment: CAEnchantment, // compatibility with 1.20.5. TODO better update system
isFromBook: Boolean) : Int {
private fun getDefaultValue(
enchantment: CAEnchantment, // compatibility with 1.20.5. TODO better update system
isFromBook: Boolean
): Int {
val enchantmentName = enchantment.key.toString()
if(enchantmentName == "minecraft:sweeping_edge"){
if (enchantmentName == "minecraft:sweeping_edge") {
var limit = enchantmentValue("minecraft:sweeping", isFromBook)
if(limit != null) return limit
if (limit != null) return limit
// legacy name
limit = enchantmentValue("sweeping", isFromBook)
if(limit != null) return limit
if (limit != null) return limit
}
val rarity = enchantment.defaultRarity()
return if(isFromBook)
return if (isFromBook)
rarity.bookValue
else
rarity.itemValue
@ -457,20 +446,20 @@ object ConfigOptions {
fun maxBeforeMergeDisabled(enchantment: CAEnchantment): Int {
val key = enchantment.key.toString()
var value = maxBeforeMergeDisabled(key)
if(value != null) return value
if (value != null) return value
// Legacy name
val legacy = enchantment.enchantmentName
value = maxBeforeMergeDisabled(legacy)
if(value != null) return value
if (value != null) return value
if(key == "minecraft:sweeping_edge"){
if (key == "minecraft:sweeping_edge") {
value = maxBeforeMergeDisabled("minecraft:sweeping")
if(value != null) return value
if (value != null) return value
// legacy name of legacy enchantment name
value = maxBeforeMergeDisabled("sweeping")
if(value != null) return value
if (value != null) return value
}
return DEFAULT_MAX_BEFORE_MERGE_DISABLED
@ -480,7 +469,7 @@ object ConfigOptions {
* Get the given [enchantmentName]'s level before merge is disabled
* a negative value would mean never disabled
*/
private fun maxBeforeMergeDisabled(enchantmentName: String) : Int? {
private fun maxBeforeMergeDisabled(enchantmentName: String): Int? {
// find if set
val path = "${DISABLE_MERGE_OVER_ROOT}.$enchantmentName"
@ -490,80 +479,4 @@ object ConfigOptions {
.takeIf { it in ENCHANT_LIMIT_RANGE }
}
// ----------
// Lore edits
// ----------
/**
* If we should allow appending lore via book and quil
*/
val appendLoreBookAndQuil: Boolean
get() {
return ConfigHolder.DEFAULT_CONFIG
.config
.getBoolean(APPEND_LORE_BOOK_AND_QUIL, DEFAULT_APPEND_LORE_BOOK_AND_QUIL)
}
/**
* If we should allow appending lore line via paper
*/
val appendLoreLinePaper: Boolean
get() {
return ConfigHolder.DEFAULT_CONFIG
.config
.getBoolean(APPEND_LORE_LINE_PAPER, DEFAULT_APPEND_LORE_LINE_PAPER)
}
/**
* If we should allow removing lore via book and quil
*/
val removeLoreBookAndQuil: Boolean
get() {
return ConfigHolder.DEFAULT_CONFIG
.config
.getBoolean(APPEND_LORE_BOOK_AND_QUIL, DEFAULT_APPEND_LORE_BOOK_AND_QUIL)
}
/**
* If we should allow removing lore line via paper
*/
val removeLoreLinePaper: Boolean
get() {
return ConfigHolder.DEFAULT_CONFIG
.config
.getBoolean(APPEND_LORE_LINE_PAPER, DEFAULT_APPEND_LORE_LINE_PAPER)
}
/**
* Get if we should append/remove at the end or at the start of the lore list
* This may change to an "OrderType" enum or equivalent later
*/
val paperLoreOrderIsEnd: Boolean
get() {
return ConfigHolder.DEFAULT_CONFIG
.config
.getString(LORE_LINE_WITH_PAPER_ORDER, DEFAULT_LORE_LINE_WITH_PAPER_ORDER)
.equals(DEFAULT_LORE_LINE_WITH_PAPER_ORDER, ignoreCase = true)
}
/**
* If lore edit via book need permission
*/
val BookLoreEditNeedPermission: Boolean
get() {
return ConfigHolder.DEFAULT_CONFIG
.config
.getBoolean(EDIT_LORE_WITH_BOOK_NEED_PERMISSION, DEFAULT_EDIT_LORE_WITH_BOOK_NEED_PERMISSION)
}
/**
* If lore edit via paper need permission
*/
val PaperLoreEditNeedPermission: Boolean
get() {
return ConfigHolder.DEFAULT_CONFIG
.config
.getBoolean(EDIT_LORE_WITH_PAPER_NEED_PERMISSION, DEFAULT_EDIT_LORE_WITH_PAPER_NEED_PERMISSION)
}
}

View file

@ -26,6 +26,7 @@ import xyz.alexcrea.cuanvil.util.AnvilUseType
import xyz.alexcrea.cuanvil.util.AnvilXpUtil
import xyz.alexcrea.cuanvil.util.CustomRecipeUtil
import xyz.alexcrea.cuanvil.util.UnitRepairUtil.getRepair
import xyz.alexcrea.cuanvil.util.config.LoreEditConfigUtil
import java.util.*
import kotlin.math.min
@ -411,7 +412,7 @@ class AnvilResultListener : Listener {
val lore = leftMeta.lore!!
if (lore.isEmpty()) return false
val removeEnd = ConfigOptions.paperLoreOrderIsEnd
val removeEnd = LoreEditConfigUtil.paperLoreOrderIsEnd
//TODO check & do color
val line = if (removeEnd) lore[lore.size - 1]
else lore[0]

View file

@ -1,10 +1,11 @@
package xyz.alexcrea.cuanvil.util
import io.delilaheve.util.ConfigOptions
import org.bukkit.entity.HumanEntity
import org.bukkit.inventory.ItemStack
import org.bukkit.inventory.meta.BookMeta
import org.bukkit.permissions.Permissible
import xyz.alexcrea.cuanvil.util.config.LoreEditConfigUtil
import xyz.alexcrea.cuanvil.util.config.LoreEditType
object AnvilLoreEditUtil {
@ -12,11 +13,11 @@ object AnvilLoreEditUtil {
private const val LORE_BY_PAPER: String = "ca.lore_edit.paper"
private fun hasLoreEditByBookPermission(player: Permissible): Boolean {
return ConfigOptions.BookLoreEditNeedPermission && player.hasPermission(LORE_BY_BOOK)
return LoreEditConfigUtil.bookLoreEditNeedPermission && player.hasPermission(LORE_BY_BOOK)
}
private fun hasLoreEditByPaperPermission(player: Permissible): Boolean {
return ConfigOptions.PaperLoreEditNeedPermission && player.hasPermission(LORE_BY_PAPER)
return LoreEditConfigUtil.paperLoreEditNeedPermission && player.hasPermission(LORE_BY_PAPER)
}
fun handleLoreAppendByBook(player: Permissible, first: ItemStack, book: BookMeta): ItemStack? {
@ -58,7 +59,7 @@ object AnvilLoreEditUtil {
if (meta.hasPages() && meta.pageCount >= 1) {
// Test if the pages is ok
for (page in meta.pages) {
if (page.isNotEmpty()) {
if (page.isNotBlank()) {
hasContent = true
break
}
@ -68,9 +69,9 @@ object AnvilLoreEditUtil {
// We don't want to "add" the first page is there is content and the first page is empty
if (hasContent) {
if (meta.pages[0].isEmpty()) return null
if (ConfigOptions.appendLoreBookAndQuil)
if (LoreEditType.APPEND_BOOK.enabled)
return true
} else if (ConfigOptions.removeLoreBookAndQuil) {
} else if (LoreEditType.REMOVE_BOOK.enabled) {
if (!first.hasItemMeta()) return null
val leftMeta = first.itemMeta!!
@ -95,9 +96,9 @@ object AnvilLoreEditUtil {
val hasContent = meta.hasDisplayName()
if (hasContent) {
if (ConfigOptions.appendLoreBookAndQuil)
if (LoreEditType.APPEND_PAPER.enabled)
return true
} else if (ConfigOptions.removeLoreBookAndQuil) {
} else if (LoreEditType.REMOVE_PAPER.enabled) {
if (!first.hasItemMeta()) return null
val leftMeta = first.itemMeta!!
@ -116,7 +117,7 @@ object AnvilLoreEditUtil {
ArrayList<String>(meta.lore!!)
} else ArrayList()
val appendEnd = ConfigOptions.paperLoreOrderIsEnd
val appendEnd = LoreEditConfigUtil.paperLoreOrderIsEnd
//TODO check color if color if enabled
val line = second.itemMeta!!.displayName
@ -138,7 +139,7 @@ object AnvilLoreEditUtil {
val result = first.clone()
val meta = result.itemMeta!!
val removeEnd = ConfigOptions.paperLoreOrderIsEnd
val removeEnd = LoreEditConfigUtil.paperLoreOrderIsEnd
val lore: ArrayList<String> = ArrayList(meta.lore!!)
if(removeEnd) lore.removeAt(lore.size - 1)

View file

@ -0,0 +1,177 @@
package xyz.alexcrea.cuanvil.util.config
import xyz.alexcrea.cuanvil.config.ConfigHolder.DEFAULT_CONFIG as CONFIG
object LoreEditConfigUtil {
// Per edit type configs Path
const val IS_ENABLED = "enabled"
const val FIXED_COST = "fixed_cost"
const val PER_LINE_COST = "per_line_cost"
const val USE_COST_PENALTY = "use_cost_penalty"
const val INCREASE_COST_PENALTY = "increase_cost_penalty"
const val DO_CONSUME = "do_consume"
// Permission configs path
const val BOOK_PERMISSION_NEEDED = "lore_edit.book_and_quil.use_permission"
const val PAPER_PERMISSION_NEEDED = "lore_edit.paper.use_permission"
// Color configs path
const val COLOR_BOOK_COLOR_CODE = "lore_edit.book_and_quil.color.allow_color_code"
const val COLOR_BOOK_HEX = "lore_edit.book_and_quil.color.allow_hexadecimal_color"
const val COLOR_BOOK_COST = "lore_edit.book_and_quil.color.use_cost"
const val COLOR_PAPER_COLOR_CODE = "lore_edit.paper.color.allow_color_code"
const val COLOR_PAPER_HEX = "lore_edit.paper.color.allow_hexadecimal_color"
const val COLOR_PAPER_COST = "lore_edit.paper.color.use_cost"
// Lore order config path
const val PAPER_EDIT_ORDER = "lore_edit.paper.order"
// --------------
// Default Values
// --------------
// Per edit type configs defaults
const val DEFAULT_IS_ENABLED = true
const val DEFAULT_FIXED_COST = 1
const val DEFAULT_PER_LINE_COST = 0
const val DEFAULT_USE_COST_PENALTY = false
const val DEFAULT_INCREASE_COST_PENALTY = false
const val DEFAULT_DO_CONSUME = false
// Permission configs defaults
const val DEFAULT_BOOK_PERMISSION_NEEDED = true
const val DEFAULT_PAPER_PERMISSION_NEEDED = true
// Color configs defaults
const val DEFAULT_COLOR_BOOK_COLOR_CODE = true
const val DEFAULT_COLOR_BOOK_HEX = true
const val DEFAULT_COLOR_BOOK_COST = 0
const val DEFAULT_COLOR_PAPER_COLOR_CODE = true
const val DEFAULT_COLOR_PAPER_HEX = true
const val DEFAULT_COLOR_PAPER_COST = 0
// Lore order config default
const val DEFAULT_PAPER_EDIT_ORDER = "end"
// -------------
// Config Ranges
// -------------
val FIXED_COST_RANGE = 0..1000
val PER_LINE_COST_RANGE = 0..1000
val COLOR_BOOK_COST_RANGE = 0..1000
val COLOR_PAPER_COST_RANGE = 0..1000
// -------------------
// Generic Get methods
// -------------------
/**
* Get if we should append/remove at the end or at the start of the lore list
* This may change to an "OrderType" enum or equivalent later
*/
val paperLoreOrderIsEnd: Boolean
get() {
return CONFIG
.config
.getString(PAPER_EDIT_ORDER, DEFAULT_PAPER_EDIT_ORDER)
.equals(DEFAULT_PAPER_EDIT_ORDER, ignoreCase = true)
}
/**
* If lore edit via book need permission
*/
val bookLoreEditNeedPermission: Boolean
get() {
return CONFIG
.config
.getBoolean(BOOK_PERMISSION_NEEDED, DEFAULT_BOOK_PERMISSION_NEEDED)
}
/**
* If lore edit via paper need permission
*/
val paperLoreEditNeedPermission: Boolean
get() {
return CONFIG
.config
.getBoolean(PAPER_PERMISSION_NEEDED, DEFAULT_PAPER_PERMISSION_NEEDED)
}
// -----------------
// Color Get methods
// -----------------
// book edit functions
/**
* Allow usage of color code on book lore edit
*/
val bookAllowColorCode: Boolean
get() {
return CONFIG
.config
.getBoolean(COLOR_BOOK_COLOR_CODE, DEFAULT_COLOR_BOOK_COLOR_CODE)
}
/**
* Allow usage of hexadecimal color on book lore edit
*/
val bookAllowHexColor: Boolean
get() {
return CONFIG
.config
.getBoolean(COLOR_BOOK_HEX, DEFAULT_COLOR_BOOK_HEX)
}
/**
* Cost when using either color code and hex color on book edit
*/
val bookUseColorCost: Int
get() {
return CONFIG
.config
.getInt(COLOR_BOOK_COST, DEFAULT_COLOR_BOOK_COST)
.takeIf { it in COLOR_BOOK_COST_RANGE }
?: DEFAULT_COLOR_BOOK_COST
}
// paper edit functions
/**
* Allow usage of color code on paper lore edit
*/
val paperAllowColorCode: Boolean
get() {
return CONFIG
.config
.getBoolean(COLOR_PAPER_COLOR_CODE, DEFAULT_COLOR_PAPER_COLOR_CODE)
}
/**
* Allow usage of hexadecimal color on paper lore edit
*/
val paperAllowHexColor: Boolean
get() {
return CONFIG
.config
.getBoolean(COLOR_PAPER_HEX, DEFAULT_COLOR_PAPER_HEX)
}
/**
* Cost when using either color code and hex color on paper edit
*/
val paperUseColorCost: Int
get() {
return CONFIG
.config
.getInt(COLOR_PAPER_COST, DEFAULT_COLOR_PAPER_COST)
.takeIf { it in COLOR_PAPER_COST_RANGE }
?: DEFAULT_COLOR_PAPER_COST
}
}

View file

@ -0,0 +1,87 @@
package xyz.alexcrea.cuanvil.util.config
import xyz.alexcrea.cuanvil.config.ConfigHolder.DEFAULT_CONFIG as CONFIG
enum class LoreEditType(
val rootPath: String,
val isAppend: Boolean,
) {
APPEND_BOOK("lore_edit.book_and_quil.append", true),
REMOVE_BOOK("lore_edit.book_and_quil.remove", false),
APPEND_PAPER("lore_edit.paper.append", true),
REMOVE_PAPER("lore_edit.paper.remove", false),
;
/**
* If this edit type is enabled
*/
val enabled: Boolean
get() {
return CONFIG
.config
.getBoolean("${rootPath}.${LoreEditConfigUtil.IS_ENABLED}", LoreEditConfigUtil.DEFAULT_IS_ENABLED)
}
/**
* Fixed cost added to this edit
*/
val fixedCost: Int
get() {
return CONFIG
.config
.getInt("${rootPath}.${LoreEditConfigUtil.FIXED_COST}", LoreEditConfigUtil.DEFAULT_FIXED_COST)
.takeIf { it in LoreEditConfigUtil.FIXED_COST_RANGE }
?: LoreEditConfigUtil.DEFAULT_FIXED_COST
}
/**
* Cost added per line added
*/
val perLineCost: Int
get() {
return CONFIG
.config
.getInt("${rootPath}.${LoreEditConfigUtil.PER_LINE_COST}", LoreEditConfigUtil.DEFAULT_PER_LINE_COST)
.takeIf { it in LoreEditConfigUtil.PER_LINE_COST_RANGE }
?: LoreEditConfigUtil.DEFAULT_PER_LINE_COST
}
/**
* If the edit should use the item's cost penalty
*/
val useCostPenalty: Boolean
get() {
return CONFIG
.config
.getBoolean(
"${rootPath}.${LoreEditConfigUtil.USE_COST_PENALTY}",
LoreEditConfigUtil.DEFAULT_USE_COST_PENALTY
)
}
/**
* If the edit should increase the items cost penalty
*/
val increaseCostPenalty: Boolean
get() {
return CONFIG
.config
.getBoolean(
"${rootPath}.${LoreEditConfigUtil.INCREASE_COST_PENALTY}",
LoreEditConfigUtil.DEFAULT_INCREASE_COST_PENALTY
)
}
/**
* If the edit should consume the provided material
*/
val doConsume: Boolean
get() {
if (!isAppend) throw IllegalStateException("Lore edit Consume test should not happen on append")
return CONFIG
.config
.getBoolean("${rootPath}.${LoreEditConfigUtil.DO_CONSUME}", LoreEditConfigUtil.DEFAULT_DO_CONSUME)
}
}

View file

@ -273,18 +273,80 @@ disable-merge-over:
# Settings for lore modification
lore_edit:
book_and_quil:
# Permission is ca.lore_edit.book
use_permission: true
# permission is ca.lore_edit.book
append: false
remove: false
append:
# If adding lore using book & quil is enabled
enabled: false
# Cost used every time
fixed_cost: 1
# Cost used for every lore line added
per_line_cost: 0
# Use left item cost penalty if any
use_cost_penalty: false
# Increase left item cost penalty
increase_cost_penalty: false
# If adding the lore consume the book & quil
do_consume: false
remove:
# If removing lore using book & quil is enabled
enabled: false
# Cost used every time
fixed_cost: 1
# Cost used for every lore line removed
per_line_cost: 0
# Use left item cost penalty if any
use_cost_penalty: false
# Increase left item cost penalty
increase_cost_penalty: false
# Allow using color code and hexadecimal color when editing lore via book & quil
#
# Color code are prefixed by "&" and hexadecimal color by "#"
# Color code will not be applied if it colors nothing. "&&" can be used to write "&"
color:
allow_color_code: true
allow_hexadecimal_color: true
use_cost: 0
paper:
# Permission is ca.lore_edit.paper
use_permission: true
# permission is ca.lore_edit.paper
append_line: false
remove_line: false
# what order should the lines should get added/removed (start/end, if invalid or not present will be end)
order: "end"
append_line:
# If adding lore line using paper is enabled
enabled: false
# Cost used every time
fixed_cost: 1
# Use left item cost penalty if any
use_cost_penalty: false
# Increase left item cost penalty
increase_cost_penalty: false
# If adding the lore line consume the paper
do_consume: false
remove_line:
# If removing lore line using paper is enabled
enabled: false
# Cost used every time
fixed_cost: 1
# Use left item cost penalty if any
use_cost_penalty: false
# Increase left item cost penalty
increase_cost_penalty: false
# Allow using color code and hexadecimal color when editing lore via book & quil
#
# Color code are prefixed by "&" and hexadecimal color by "#"
# Color code will not be applied if it colors nothing. "&&" can be used to write "&"
color:
allow_color_code: true
allow_hexadecimal_color: true
use_cost: 0
# Whether to show debug logging
debug_log: false