Automaticly add default value when value is absent

This commit is contained in:
alexcrea 2024-09-13 14:31:59 +02:00
parent 3bdb0ce536
commit cfe0faf456
No known key found for this signature in database
GPG key ID: 43FD265DB0DBF91F
3 changed files with 67 additions and 2 deletions

View file

@ -14,6 +14,7 @@ import xyz.alexcrea.cuanvil.enchant.CAEnchantmentRegistry
import xyz.alexcrea.cuanvil.gui.config.MainConfigGui
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant
import xyz.alexcrea.cuanvil.listener.ChatEventListener
import xyz.alexcrea.cuanvil.update.PluginSetDefault
import xyz.alexcrea.cuanvil.update.Update_1_21
import xyz.alexcrea.cuanvil.util.Metrics
import java.io.File
@ -146,6 +147,9 @@ class CustomAnvil : JavaPlugin() {
MainConfigGui.getInstance().init(DependencyManager.packetManager)
GuiSharedConstant.loadConstants()
// Finally, re add default we may be missing
PluginSetDefault.reAddMissingDefault()
}
fun reloadResource(

View file

@ -36,7 +36,7 @@ object ConfigOptions {
const val WORK_PENALTY_TYPE = "work_penalty_type"
private const val DEFAULT_LIMIT_PATH = "default_limit"
const val DEFAULT_LIMIT_PATH = "default_limit"
const val ENCHANT_LIMIT_ROOT = "enchant_limits"
const val ENCHANT_VALUES_ROOT = "enchant_values"
@ -72,7 +72,7 @@ object ConfigOptions {
const val DEFAULT_PERMISSION_NEEDED_FOR_COLOR = true
const val DEFAULT_USE_OF_COLOR_COST = 0
private const val DEFAULT_ENCHANT_LIMIT = 5
const val DEFAULT_ENCHANT_LIMIT = 5
// Debug flag
private const val DEFAULT_DEBUG_LOG = false