mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-08-28 08:25:56 +02:00
multiples config related add
Some checks are pending
Java CI with Gradle / build (push) Waiting to run
Some checks are pending
Java CI with Gradle / build (push) Waiting to run
- Disable console debug by default - Display log on get to console and not "click to copy"
This commit is contained in:
parent
7ea708ec14
commit
447859848b
9 changed files with 74 additions and 19 deletions
|
|
@ -117,6 +117,9 @@ permission_needed_for_dialog_rename: false
|
|||
# For practical reason. this only work when dialog rename is enabled
|
||||
dialog_rename_keep_user_text: true
|
||||
|
||||
# Also count left item enchantments for the final price
|
||||
include_left_enchantment_for_cost: false
|
||||
|
||||
# Override limits for specific enchants
|
||||
#
|
||||
# Enchantments not listed here will use the value of default_limit
|
||||
|
|
@ -169,8 +172,8 @@ enchant_limits:
|
|||
|
||||
# Multipliers used to calculate the enchantment's value in repair/combining
|
||||
#
|
||||
# Values here are pulled from the fandom wiki:
|
||||
# https://minecraft.fandom.com/wiki/Anvil_mechanics#Costs_for_combining_enchantments
|
||||
# Values here are pulled from the minecraft wiki:
|
||||
# https://minecraft.wiki/w/Anvil_mechanics#Costs_for_combining_enchantments
|
||||
#
|
||||
# If an enchantment is missing values here, or is less than 0, it will default to 0
|
||||
#
|
||||
|
|
@ -463,4 +466,7 @@ debug_log: false
|
|||
# Whether to show verbose debug logging
|
||||
debug_log_verbose: false
|
||||
|
||||
# Whether to show inside the console or require to run /ca debug get
|
||||
display_debug_in_console: false
|
||||
|
||||
configVersion: 1.11.0
|
||||
|
|
|
|||
|
|
@ -119,6 +119,9 @@ permission_needed_for_dialog_rename: false
|
|||
# For practical reason. this only work when dialog rename is enabled
|
||||
dialog_rename_keep_user_text: true
|
||||
|
||||
# Also count left item enchantments for the final price
|
||||
include_left_enchantment_for_cost: false
|
||||
|
||||
# Override limits for specific enchants
|
||||
#
|
||||
# Enchantments not listed here will use the value of default_limit
|
||||
|
|
@ -175,8 +178,8 @@ enchant_limits:
|
|||
|
||||
# Multipliers used to calculate the enchantment's value in repair/combining
|
||||
#
|
||||
# Values here are pulled from the fandom wiki:
|
||||
# https://minecraft.fandom.com/wiki/Anvil_mechanics#Costs_for_combining_enchantments
|
||||
# Values here are pulled from the minecraft wiki:
|
||||
# https://minecraft.wiki/w/Anvil_mechanics#Costs_for_combining_enchantments
|
||||
#
|
||||
# If an enchantment is missing values here, or is less than 0, it will default to 0
|
||||
#
|
||||
|
|
@ -483,5 +486,8 @@ debug_log: false
|
|||
# Whether to show verbose debug logging
|
||||
debug_log_verbose: false
|
||||
|
||||
# Whether to show inside the console or require to run /ca debug get
|
||||
display_debug_in_console: false
|
||||
|
||||
configVersion: 1.15.5
|
||||
lowMinecraftVersion: 1.21.11
|
||||
|
|
|
|||
|
|
@ -117,6 +117,9 @@ permission_needed_for_dialog_rename: false
|
|||
# For practical reason. this only work when dialog rename is enabled
|
||||
dialog_rename_keep_user_text: true
|
||||
|
||||
# Also count left item enchantments for the final price
|
||||
include_left_enchantment_for_cost: false
|
||||
|
||||
# Override limits for specific enchants
|
||||
#
|
||||
# Enchantments not listed here will use the value of default_limit
|
||||
|
|
@ -172,8 +175,8 @@ enchant_limits:
|
|||
|
||||
# Multipliers used to calculate the enchantment's value in repair/combining
|
||||
#
|
||||
# Values here are pulled from the fandom wiki:
|
||||
# https://minecraft.fandom.com/wiki/Anvil_mechanics#Costs_for_combining_enchantments
|
||||
# Values here are pulled from the minecraft wiki:
|
||||
# https://minecraft.wiki/w/Anvil_mechanics#Costs_for_combining_enchantments
|
||||
#
|
||||
# If an enchantment is missing values here, or is less than 0, it will default to 0
|
||||
#
|
||||
|
|
@ -475,5 +478,8 @@ debug_log: false
|
|||
# Whether to show verbose debug logging
|
||||
debug_log_verbose: false
|
||||
|
||||
# Whether to show inside the console or require to run /ca debug get
|
||||
display_debug_in_console: false
|
||||
|
||||
configVersion: 1.11.0
|
||||
lowMinecraftVersion: 1.21.9
|
||||
|
|
|
|||
|
|
@ -117,6 +117,9 @@ permission_needed_for_dialog_rename: false
|
|||
# For practical reason. this only work when dialog rename is enabled
|
||||
dialog_rename_keep_user_text: true
|
||||
|
||||
# Also count left item enchantments for the final price
|
||||
include_left_enchantment_for_cost: false
|
||||
|
||||
# Override limits for specific enchants
|
||||
#
|
||||
# Enchantments not listed here will use the value of default_limit
|
||||
|
|
@ -169,8 +172,8 @@ enchant_limits:
|
|||
|
||||
# Multipliers used to calculate the enchantment's value in repair/combining
|
||||
#
|
||||
# Values here are pulled from the fandom wiki:
|
||||
# https://minecraft.fandom.com/wiki/Anvil_mechanics#Costs_for_combining_enchantments
|
||||
# Values here are pulled from the minecraft wiki:
|
||||
# https://minecraft.wiki/w/Anvil_mechanics#Costs_for_combining_enchantments
|
||||
#
|
||||
# If an enchantment is missing values here, or is less than 0, it will default to 0
|
||||
#
|
||||
|
|
@ -463,4 +466,7 @@ debug_log: false
|
|||
# Whether to show verbose debug logging
|
||||
debug_log_verbose: false
|
||||
|
||||
# Whether to show inside the console or require to run /ca debug get
|
||||
display_debug_in_console: false
|
||||
|
||||
configVersion: 1.11.0
|
||||
|
|
@ -66,6 +66,12 @@ public class PluginSetDefault {
|
|||
nbSet += trySetDefault(config, DIALOG_RENAME_USE_PERMISSION, DEFAULT_DIALOG_RENAME_USE_PERMISSION);
|
||||
nbSet += trySetDefault(config, DIALOG_KEEP_USER_TEXT, DEFAULT_DIALOG_KEEP_USER_TEXT);
|
||||
|
||||
nbSet += trySetDefault(config, INCLUDE_LEFT_ENCHANTMENT_FOR_COST, DEFAULT_INCLUDE_LEFT_ENCHANTMENT_FOR_COST);
|
||||
|
||||
nbSet += trySetDefault(config, DEBUG_LOGGING, DEFAULT_DEBUG_LOG);
|
||||
nbSet += trySetDefault(config, VERBOSE_DEBUG_LOGGING, DEFAULT_VERBOSE_DEBUG_LOG);
|
||||
nbSet += trySetDefault(config, SHOW_CONSOLE_DEBUG_LOGGING, DEFAULT_SHOW_CONSOLE_DEBUG_LOGGING);
|
||||
|
||||
if (nbSet > 0) {
|
||||
CustomAnvil.instance.getLogger().info("Adding " + nbSet + " absent default config values.");
|
||||
ConfigHolder.DEFAULT_CONFIG.saveToDisk(true);
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ open class CustomAnvil : JavaPlugin() {
|
|||
|
||||
private fun addToLogQueue(message: String) {
|
||||
if(debugStorageQueue.size >= 200) {
|
||||
// Let not store infinite debug logs lol
|
||||
// Let not store infinite debug logs
|
||||
debugStorageQueue.removeFirst()
|
||||
}
|
||||
|
||||
|
|
@ -88,6 +88,7 @@ open class CustomAnvil : JavaPlugin() {
|
|||
*/
|
||||
@JvmStatic fun log(message: String) {
|
||||
if (ConfigOptions.debugLog) {
|
||||
if(ConfigOptions.showDebugLogInConsole)
|
||||
instance.logger.info(message)
|
||||
addToLogQueue(message)
|
||||
}
|
||||
|
|
@ -98,6 +99,7 @@ open class CustomAnvil : JavaPlugin() {
|
|||
*/
|
||||
@JvmStatic fun verboseLog(message: String) {
|
||||
if (ConfigOptions.verboseDebugLog) {
|
||||
if(ConfigOptions.showDebugLogInConsole)
|
||||
instance.logger.info(message)
|
||||
addToLogQueue(message)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ object ConfigOptions {
|
|||
// Debug flag
|
||||
const val DEBUG_LOGGING = "debug_log"
|
||||
const val VERBOSE_DEBUG_LOGGING = "debug_log_verbose"
|
||||
const val SHOW_CONSOLE_DEBUG_LOGGING = "display_debug_in_console"
|
||||
|
||||
// ----------------------
|
||||
// Default config values
|
||||
|
|
@ -129,8 +130,9 @@ object ConfigOptions {
|
|||
const val DEFAULT_MONEY_MULTIPLIER = 1.0
|
||||
|
||||
// Debug flag
|
||||
private const val DEFAULT_DEBUG_LOG = false
|
||||
private const val DEFAULT_VERBOSE_DEBUG_LOG = false
|
||||
const val DEFAULT_DEBUG_LOG = false
|
||||
const val DEFAULT_VERBOSE_DEBUG_LOG = false
|
||||
const val DEFAULT_SHOW_CONSOLE_DEBUG_LOGGING = false
|
||||
|
||||
var OVERRIDE_DEBUG_LOG: Boolean? = null
|
||||
var OVERRIDE_VERBOSE_DEBUG_LOG: Boolean? = null
|
||||
|
|
@ -471,6 +473,19 @@ object ConfigOptions {
|
|||
.getBoolean(VERBOSE_DEBUG_LOGGING, DEFAULT_VERBOSE_DEBUG_LOG)
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to show debug in console
|
||||
*/
|
||||
val showDebugLogInConsole: Boolean
|
||||
get() {
|
||||
val overrider = OVERRIDE_VERBOSE_DEBUG_LOG
|
||||
if(overrider != null) return overrider
|
||||
|
||||
return ConfigHolder.DEFAULT_CONFIG
|
||||
.config
|
||||
.getBoolean(SHOW_CONSOLE_DEBUG_LOGGING, DEFAULT_SHOW_CONSOLE_DEBUG_LOGGING)
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the dialog menu for rename enabled
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import net.md_5.bungee.api.chat.hover.content.Text
|
|||
import org.bukkit.ChatColor
|
||||
import org.bukkit.command.Command
|
||||
import org.bukkit.command.CommandSender
|
||||
import org.bukkit.entity.Player
|
||||
import xyz.alexcrea.cuanvil.command.DiagnosticExecutor.Companion.NO_DIAG_PERM
|
||||
|
||||
class DebugToggleExecutor : CASubCommand() {
|
||||
|
|
@ -87,12 +88,16 @@ class DebugToggleExecutor : CASubCommand() {
|
|||
stb.append('\n').append(log)
|
||||
}
|
||||
|
||||
if (sender is Player) {
|
||||
val message = TextComponent(ChatColor.GREEN.toString() + "Click to copy log data")
|
||||
|
||||
message.clickEvent = ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, stb.toString())
|
||||
message.hoverEvent = HoverEvent(HoverEvent.Action.SHOW_TEXT, Text("§7Click to copy"))
|
||||
|
||||
sender.spigot().sendMessage(message);
|
||||
} else {
|
||||
sender.sendMessage(stb.toString())
|
||||
}
|
||||
}
|
||||
|
||||
override fun tabCompleter(sender: CommandSender, args: Array<out String>, list: MutableList<String>) {
|
||||
|
|
|
|||
|
|
@ -174,8 +174,8 @@ enchant_limits:
|
|||
|
||||
# Multipliers used to calculate the enchantment's value in repair/combining
|
||||
#
|
||||
# Values here are pulled from the fandom wiki:
|
||||
# https://minecraft.fandom.com/wiki/Anvil_mechanics#Costs_for_combining_enchantments
|
||||
# Values here are pulled from the minecraft wiki:
|
||||
# https://minecraft.wiki/w/Anvil_mechanics#Costs_for_combining_enchantments
|
||||
#
|
||||
# If an enchantment is missing values here, or is less than 0, it will default to 0
|
||||
#
|
||||
|
|
@ -469,4 +469,7 @@ debug_log: false
|
|||
# Whether to show verbose debug logging
|
||||
debug_log_verbose: false
|
||||
|
||||
# Whether to show inside the console or require to run /ca debug get
|
||||
display_debug_in_console: false
|
||||
|
||||
configVersion: 1.11.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue