Forgot about lore edit permission

This commit is contained in:
alexcrea 2025-03-06 21:51:28 +01:00
parent 55b4aedb3a
commit 8d558a62f0
No known key found for this signature in database
GPG key ID: 43FD265DB0DBF91F
7 changed files with 64 additions and 22 deletions

View file

@ -38,9 +38,16 @@ ca.bypass.fuse: Allow player to combine every enchantments to every item (no cus
ca.bypass.level: Allow player to bypass every level limit (no custom limit) ca.bypass.level: Allow player to bypass every level limit (no custom limit)
ca.command.reload: Allow administrator to reload the plugin's configs ca.command.reload: Allow administrator to reload the plugin's configs
ca.config.edit: Allow administrator to edit the plugin's config in game ca.config.edit: Allow administrator to edit the plugin's config in game
# Related to use of color (usage of permission for color is toggleable in basic config gui or config.yml) # Bellow permissions also require some config change to allow usage of features
ca.color.code: Allow player to use color code if permission is required (toggleable) # usage of these permission is toggleable in basic config gui or config.yml
ca.color.hex: Allow player to use hexadecimal color if permission is required (toggleable)
# Permissions related to use of color
ca.color.code: Allow player to use color code if enabled (toggleable)
ca.color.hex: Allow player to use hexadecimal color if enabled (toggleable)
# Permissions related to edition of the lore
ca.lore_edit.book: Allow player to edit lore via book and quil if enabled (toggleable)
ca.lore_edit.paper: Allow player to edit lore via paper if enabled (toggleable)
``` ```
### Commands ### Commands

View file

@ -273,15 +273,17 @@ disable-merge-over:
# Settings for lore modification # Settings for lore modification
lore_edit: lore_edit:
book_and_quil: book_and_quil:
# permission is ca.lore.book_and_quil
use_permission: true use_permission: true
# permission is ca.lore_edit.book
append: false append: false
remove: false remove: false
paper: paper:
use_permission: true
# permission is ca.lore_edit.paper
append_line: false append_line: false
remove_line: false remove_line: false
# what order should the lines should get added/removed (start/end, if invalid or not present will be end) # what order should the lines should get added/removed (start/end, if invalid or not present will be end)
order: end order: "end"
# Whether to show debug logging # Whether to show debug logging
debug_log: false debug_log: false

View file

@ -273,15 +273,17 @@ disable-merge-over:
# Settings for lore modification # Settings for lore modification
lore_edit: lore_edit:
book_and_quil: book_and_quil:
# permission is ca.lore.book_and_quil
use_permission: true use_permission: true
# permission is ca.lore_edit.book
append: false append: false
remove: false remove: false
paper: paper:
use_permission: true
# permission is ca.lore_edit.paper
append_line: false append_line: false
remove_line: false remove_line: false
# what order should the lines should get added/removed (start/end, if invalid or not present will be end) # what order should the lines should get added/removed (start/end, if invalid or not present will be end)
order: end order: "end"
# Whether to show debug logging # Whether to show debug logging
debug_log: false debug_log: false

View file

@ -30,10 +30,14 @@ public class PluginSetDefault {
nbSet+= trySetDefault(config, APPEND_LORE_BOOK_AND_QUIL, DEFAULT_APPEND_LORE_BOOK_AND_QUIL); 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, 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_BOOK_AND_QUIL, DEFAULT_REMOVE_LORE_BOOK_AND_QUIL);
nbSet+= trySetDefault(config, REMOVE_LORE_LINE_PAPER, DEFAULT_REMOVE_LORE_LINE_PAPER); 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); 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);
if(nbSet > 0){ if(nbSet > 0){
CustomAnvil.instance.getLogger().info("Adding " + nbSet + " absent default config values."); CustomAnvil.instance.getLogger().info("Adding " + nbSet + " absent default config values.");
ConfigHolder.DEFAULT_CONFIG.saveToDisk(true); ConfigHolder.DEFAULT_CONFIG.saveToDisk(true);

View file

@ -54,10 +54,14 @@ object ConfigOptions {
// Lore edit configs // Lore edit configs
const val APPEND_LORE_BOOK_AND_QUIL = "lore_edit.book_and_quil.append" 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 REMOVE_LORE_BOOK_AND_QUIL = "lore_edit.book_and_quil.remove"
const val APPEND_LORE_LINE_PAPER = "lore_edit.paper.append_line" const val APPEND_LORE_LINE_PAPER = "lore_edit.paper.append_line"
const val REMOVE_LORE_LINE_PAPER = "lore_edit.paper.remove_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 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 // Keys for specific enchantment values
private const val KEY_BOOK = "book" private const val KEY_BOOK = "book"
private const val KEY_ITEM = "item" private const val KEY_ITEM = "item"
@ -94,10 +98,14 @@ object ConfigOptions {
// lore edit config // lore edit config
const val DEFAULT_APPEND_LORE_BOOK_AND_QUIL = false const val DEFAULT_APPEND_LORE_BOOK_AND_QUIL = false
const val DEFAULT_REMOVE_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_APPEND_LORE_LINE_PAPER = false
const val DEFAULT_REMOVE_LORE_LINE_PAPER = false const val DEFAULT_REMOVE_LORE_LINE_PAPER = false
const val DEFAULT_LORE_LINE_WITH_PAPER_ORDER = "end" 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 // Debug flag
private const val DEFAULT_DEBUG_LOG = false private const val DEFAULT_DEBUG_LOG = false
private const val DEFAULT_VERBOSE_DEBUG_LOG = false private const val DEFAULT_VERBOSE_DEBUG_LOG = false
@ -486,15 +494,6 @@ object ConfigOptions {
// Lore edits // 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 * If we should allow appending lore via book and quil
*/ */
@ -547,4 +546,24 @@ object ConfigOptions {
.equals(DEFAULT_LORE_LINE_WITH_PAPER_ORDER, ignoreCase = true) .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

@ -273,15 +273,17 @@ disable-merge-over:
# Settings for lore modification # Settings for lore modification
lore_edit: lore_edit:
book_and_quil: book_and_quil:
# permission is ca.lore.book_and_quil
use_permission: true use_permission: true
# permission is ca.lore_edit.book
append: false append: false
remove: false remove: false
paper: paper:
use_permission: true
# permission is ca.lore_edit.paper
append_line: false append_line: false
remove_line: false remove_line: false
# what order should the lines should get added/removed (start/end, if invalid or not present will be end) # what order should the lines should get added/removed (start/end, if invalid or not present will be end)
order: end order: "end"
# Whether to show debug logging # Whether to show debug logging
debug_log: false debug_log: false

View file

@ -42,13 +42,19 @@ permissions:
# color permissions # color permissions
ca.color.code: ca.color.code:
default: op default: op
description: Allow player to use color code if permission is required (toggleable) description: Allow player to use color code if enabled (toggleable)
ca.color.hex: ca.color.hex:
default: op default: op
description: Allow player to use hexadecimal color if permission is required (toggleable) description: Allow player to use hexadecimal color if enabled (toggleable)
# lore edit permissions
ca.lore_edit.book:
default: op
description: Allow player to edit lore via book and quil if enabled (toggleable)
ca.lore_edit.paper:
default: op
description: Allow player to edit lore via paper if enabled (toggleable)
# soft depend on old name of this plugin (UnsafeEnchantsPlus), so I can disable it if it is on the same server
# soft depend on old name (UnsafeEnchantsPlus), so I can disable it if it is on the same server (old name for this plugin)
# Also depend to other plugin for compatibility # Also depend to other plugin for compatibility
softdepend: softdepend:
- UnsafeEnchantsPlus - UnsafeEnchantsPlus