Config-Driven Plugins
Config-Driven Plugins
Section titled “Config-Driven Plugins”DaisySeries is strongest when configs contain user-friendly strings that still need to become real Bukkit enums.
Typical inputs
Section titled “Typical inputs”- menu icon materials
- click or feedback sounds
- item flag lists
- enchantments
- potion effects
- biome names
- villager professions
- attributes
- entity types
- default game modes
- difficulties
- block faces
- damage causes
- operations
- banner pattern types
- particles
- statistics
Recommended pattern
Section titled “Recommended pattern”Parse once near the configuration edge, then use canonical keys and display names everywhere else.
val icon = DaisyMaterials.parse(config.icon)val sound = DaisySounds.parse(config.sound)val flags = DaisyItemFlags.parseMany(config.flags)val enchantment = DaisyEnchantments.parse(config.enchantment)val effect = DaisyPotions.parse(config.effect)val biome = DaisyBiomes.parse(config.biome)val profession = DaisyVillagerProfessions.parse(config.profession)val attribute = DaisyAttributes.parse(config.attribute)val entity = DaisyEntities.parse(config.entity)val gameMode = DaisyGameModes.parse(config.gameMode)val difficulty = DaisyDifficulties.parse(config.difficulty)val facing = DaisyBlockFaces.parse(config.blockFace)val damageCause = DaisyDamageCauses.parse(config.damageCause)val operation = DaisyOperations.parse(config.operation)val pattern = DaisyPatternTypes.parse(config.pattern)val particle = DaisyParticles.parse(config.particle)val statistic = DaisyStatistics.parse(config.statistic)Why this is cleaner
Section titled “Why this is cleaner”- fewer
valueOf(...)wrappers - fewer local alias maps
- fewer scattered
name.lowercase()calls - one consistent error model
- one canonical key model across more of modern Minecraft