remove per line cost on single line use type

This commit is contained in:
alexcrea 2025-03-17 09:53:48 +01:00
parent 2f30e19573
commit 20d8fb6eda
No known key found for this signature in database
GPG key ID: 43FD265DB0DBF91F
2 changed files with 9 additions and 5 deletions

View file

@ -36,7 +36,9 @@ public class PluginSetDefault {
nbSet+= trySetDefault(config, path + IS_ENABLED, DEFAULT_IS_ENABLED);
nbSet+= trySetDefault(config, path + FIXED_COST, DEFAULT_FIXED_COST);
nbSet+= trySetDefault(config, path + PER_LINE_COST, DEFAULT_PER_LINE_COST);
if(value.isMultiLine()){
nbSet+= trySetDefault(config, path + PER_LINE_COST, DEFAULT_PER_LINE_COST);
}
if(value.isAppend()){
nbSet+= trySetDefault(config, path + DO_CONSUME, DEFAULT_DO_CONSUME);
}

View file

@ -7,11 +7,12 @@ enum class LoreEditType(
val rootPath: String,
val useType: AnvilUseType,
val isAppend: Boolean,
val isMultiLine: Boolean,
) {
APPEND_BOOK("lore_edit.book_and_quil.append", AnvilUseType.LORE_EDIT_BOOK_APPEND, true),
REMOVE_BOOK("lore_edit.book_and_quil.remove", AnvilUseType.LORE_EDIT_BOOK_REMOVE,false),
APPEND_PAPER("lore_edit.paper.append", AnvilUseType.LORE_EDIT_PAPER_APPEND,true),
REMOVE_PAPER("lore_edit.paper.remove", AnvilUseType.LORE_EDIT_PAPER_REMOVE,false),
APPEND_BOOK("lore_edit.book_and_quil.append", AnvilUseType.LORE_EDIT_BOOK_APPEND, true, true),
REMOVE_BOOK("lore_edit.book_and_quil.remove", AnvilUseType.LORE_EDIT_BOOK_REMOVE,false, true),
APPEND_PAPER("lore_edit.paper.append", AnvilUseType.LORE_EDIT_PAPER_APPEND,true, false),
REMOVE_PAPER("lore_edit.paper.remove", AnvilUseType.LORE_EDIT_PAPER_REMOVE,false, false),
;
/**
@ -41,6 +42,7 @@ enum class LoreEditType(
*/
val perLineCost: Int
get() {
if (!isMultiLine) throw IllegalStateException("Per line cost get on single line edit type")
return CONFIG
.config
.getInt("${rootPath}.${LoreEditConfigUtil.PER_LINE_COST}", LoreEditConfigUtil.DEFAULT_PER_LINE_COST)