Forgot about lore edit permission

This commit is contained in:
alexcrea 2025-03-06 21:51:28 +01:00
parent a0fe84a9d4
commit 11cd5d1842
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.command.reload: Allow administrator to reload the plugin's configs
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)
ca.color.code: Allow player to use color code if permission is required (toggleable)
ca.color.hex: Allow player to use hexadecimal color if permission is required (toggleable)
# Bellow permissions also require some config change to allow usage of features
# usage of these permission is toggleable in basic config gui or config.yml
# 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

View file

@ -273,15 +273,17 @@ disable-merge-over:
# Settings for lore modification
lore_edit:
book_and_quil:
# permission is ca.lore.book_and_quil
use_permission: true
# permission is ca.lore_edit.book
append: false
remove: false
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
order: "end"
# Whether to show debug logging
debug_log: false

View file

@ -273,15 +273,17 @@ disable-merge-over:
# Settings for lore modification
lore_edit:
book_and_quil:
# permission is ca.lore.book_and_quil
use_permission: true
# permission is ca.lore_edit.book
append: false
remove: false
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
order: "end"
# Whether to show debug logging
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_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);
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){
CustomAnvil.instance.getLogger().info("Adding " + nbSet + " absent default config values.");
ConfigHolder.DEFAULT_CONFIG.saveToDisk(true);

View file

@ -54,10 +54,14 @@ object ConfigOptions {
// 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"
@ -94,10 +98,14 @@ object ConfigOptions {
// 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
@ -486,15 +494,6 @@ object ConfigOptions {
// 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
*/
@ -547,4 +546,24 @@ object ConfigOptions {
.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
lore_edit:
book_and_quil:
# permission is ca.lore.book_and_quil
use_permission: true
# permission is ca.lore_edit.book
append: false
remove: false
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
order: "end"
# Whether to show debug logging
debug_log: false

View file

@ -42,13 +42,19 @@ permissions:
# color permissions
ca.color.code:
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:
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 (UnsafeEnchantsPlus), so I can disable it if it is on the same server (old name for this plugin)
# soft depend on old name of this plugin (UnsafeEnchantsPlus), so I can disable it if it is on the same server
# Also depend to other plugin for compatibility
softdepend:
- UnsafeEnchantsPlus