mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
Lore edit config values
This commit is contained in:
parent
cf022cf36c
commit
55b4aedb3a
5 changed files with 140 additions and 14 deletions
|
|
@ -1,11 +1,12 @@
|
|||
package xyz.alexcrea.cuanvil.update;
|
||||
|
||||
import io.delilaheve.CustomAnvil;
|
||||
import io.delilaheve.util.ConfigOptions;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
||||
|
||||
import static io.delilaheve.util.ConfigOptions.*;
|
||||
|
||||
public class PluginSetDefault {
|
||||
|
||||
public static void reAddMissingDefault(){
|
||||
|
|
@ -13,19 +14,25 @@ public class PluginSetDefault {
|
|||
|
||||
int nbSet = 0;
|
||||
|
||||
nbSet+= trySetDefault(config, ConfigOptions.CAP_ANVIL_COST, ConfigOptions.DEFAULT_CAP_ANVIL_COST);
|
||||
nbSet+= trySetDefault(config, ConfigOptions.MAX_ANVIL_COST, ConfigOptions.DEFAULT_MAX_ANVIL_COST);
|
||||
nbSet+= trySetDefault(config, ConfigOptions.REMOVE_ANVIL_COST_LIMIT, ConfigOptions.DEFAULT_REMOVE_ANVIL_COST_LIMIT);
|
||||
nbSet+= trySetDefault(config, ConfigOptions.REPLACE_TOO_EXPENSIVE, ConfigOptions.DEFAULT_REPLACE_TOO_EXPENSIVE);
|
||||
nbSet+= trySetDefault(config, ConfigOptions.ITEM_REPAIR_COST, ConfigOptions.DEFAULT_ITEM_REPAIR_COST);
|
||||
nbSet+= trySetDefault(config, ConfigOptions.UNIT_REPAIR_COST, ConfigOptions.DEFAULT_UNIT_REPAIR_COST);
|
||||
nbSet+= trySetDefault(config, ConfigOptions.ITEM_RENAME_COST, ConfigOptions.DEFAULT_ITEM_RENAME_COST);
|
||||
nbSet+= trySetDefault(config, ConfigOptions.SACRIFICE_ILLEGAL_COST, ConfigOptions.DEFAULT_SACRIFICE_ILLEGAL_COST);
|
||||
nbSet+= trySetDefault(config, ConfigOptions.ALLOW_COLOR_CODE, ConfigOptions.DEFAULT_ALLOW_COLOR_CODE);
|
||||
nbSet+= trySetDefault(config, ConfigOptions.ALLOW_HEXADECIMAL_COLOR, ConfigOptions.DEFAULT_ALLOW_HEXADECIMAL_COLOR);
|
||||
nbSet+= trySetDefault(config, ConfigOptions.PERMISSION_NEEDED_FOR_COLOR, ConfigOptions.DEFAULT_PERMISSION_NEEDED_FOR_COLOR);
|
||||
nbSet+= trySetDefault(config, ConfigOptions.USE_OF_COLOR_COST, ConfigOptions.DEFAULT_USE_OF_COLOR_COST);
|
||||
nbSet+= trySetDefault(config, ConfigOptions.DEFAULT_LIMIT_PATH, ConfigOptions.DEFAULT_ENCHANT_LIMIT);
|
||||
nbSet+= trySetDefault(config, CAP_ANVIL_COST, DEFAULT_CAP_ANVIL_COST);
|
||||
nbSet+= trySetDefault(config, MAX_ANVIL_COST, DEFAULT_MAX_ANVIL_COST);
|
||||
nbSet+= trySetDefault(config, REMOVE_ANVIL_COST_LIMIT, DEFAULT_REMOVE_ANVIL_COST_LIMIT);
|
||||
nbSet+= trySetDefault(config, REPLACE_TOO_EXPENSIVE, DEFAULT_REPLACE_TOO_EXPENSIVE);
|
||||
nbSet+= trySetDefault(config, ITEM_REPAIR_COST, DEFAULT_ITEM_REPAIR_COST);
|
||||
nbSet+= trySetDefault(config, UNIT_REPAIR_COST, DEFAULT_UNIT_REPAIR_COST);
|
||||
nbSet+= trySetDefault(config, ITEM_RENAME_COST, DEFAULT_ITEM_RENAME_COST);
|
||||
nbSet+= trySetDefault(config, SACRIFICE_ILLEGAL_COST, DEFAULT_SACRIFICE_ILLEGAL_COST);
|
||||
nbSet+= trySetDefault(config, ALLOW_COLOR_CODE, DEFAULT_ALLOW_COLOR_CODE);
|
||||
nbSet+= trySetDefault(config, ALLOW_HEXADECIMAL_COLOR, DEFAULT_ALLOW_HEXADECIMAL_COLOR);
|
||||
nbSet+= trySetDefault(config, PERMISSION_NEEDED_FOR_COLOR, DEFAULT_PERMISSION_NEEDED_FOR_COLOR);
|
||||
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);
|
||||
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);
|
||||
nbSet+= trySetDefault(config, REMOVE_LORE_LINE_PAPER, DEFAULT_REMOVE_LORE_LINE_PAPER);
|
||||
nbSet+= trySetDefault(config, LORE_LINE_WITH_PAPER_ORDER, DEFAULT_LORE_LINE_WITH_PAPER_ORDER);
|
||||
|
||||
if(nbSet > 0){
|
||||
CustomAnvil.instance.getLogger().info("Adding " + nbSet + " absent default config values.");
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ object ConfigOptions {
|
|||
const val PERMISSION_NEEDED_FOR_COLOR = "permission_needed_for_color"
|
||||
const val USE_OF_COLOR_COST = "use_of_color_cost"
|
||||
|
||||
// Work penalty config
|
||||
const val WORK_PENALTY_ROOT = "work_penalty"
|
||||
const val WORK_PENALTY_INCREASE = "shared_increase"
|
||||
const val WORK_PENALTY_ADDITIVE = "shared_additive"
|
||||
|
|
@ -50,6 +51,13 @@ 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"
|
||||
|
||||
// Keys for specific enchantment values
|
||||
private const val KEY_BOOK = "book"
|
||||
private const val KEY_ITEM = "item"
|
||||
|
|
@ -83,6 +91,13 @@ 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"
|
||||
|
||||
// Debug flag
|
||||
private const val DEFAULT_DEBUG_LOG = false
|
||||
private const val DEFAULT_VERBOSE_DEBUG_LOG = false
|
||||
|
|
@ -467,4 +482,69 @@ object ConfigOptions {
|
|||
.takeIf { it in ENCHANT_LIMIT_RANGE }
|
||||
}
|
||||
|
||||
// ----------
|
||||
// Lore edits
|
||||
// ----------
|
||||
|
||||
/*
|
||||
|
||||
const val DEFAULT_APPEND_LORE_WITH_BOOK_AND_QUIL = false
|
||||
const val DEFAULT_REMOVE_LORE_WITH_BOOK_AND_QUIL = false
|
||||
const val DEFAULT_APPEND_LORE_LINE_WITH_PAPER = false
|
||||
const val DEFAULT_REMOVE_LORE_LINE_WITH_PAPER = false
|
||||
const val DEFAULT_LORE_LINE_WITH_PAPER_ORDER = "end"
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -270,6 +270,19 @@ disable-merge-over:
|
|||
# If uncommented. 2 unbreaking II book would not give an unbreaking III book. but unbreaking III book can still be applied
|
||||
#minecraft:unbreaking: 2
|
||||
|
||||
# Settings for lore modification
|
||||
lore_edit:
|
||||
book_and_quil:
|
||||
# permission is ca.lore.book_and_quil
|
||||
use_permission: true
|
||||
append: false
|
||||
remove: false
|
||||
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
|
||||
|
||||
# Whether to show debug logging
|
||||
debug_log: false
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue