multification
2 min read
Configuration
Store `Notice` objects in YAML config files using CDN or Okaeri serializers.
Store `Notice` objects in YAML config files using CDN or Okaeri serializers.
Configuring Multification is about serializing Notice objects to YAML so non-developers can edit messages safely. We ship serializers for two popular config libraries:
If you only need a YAML reference for message shapes, see the Format guide (for users).
Cdn cdn = CdnFactory.createYamlLike()
.getSettings()
.withComposer(Notice.class, new MultificationNoticeCdnComposer(multification))
.build();
MessagesConfig config = new MessagesConfig();
cdn.load(Source.of(new File(dataFolder, "messages.yml")), config)
.orThrow(RuntimeException::new);
cdn.render(config, Source.of(file))
.orThrow(RuntimeException::new);
cdn.load(Source.of(file), config).orThrow(RuntimeException::new);
MessagesConfig config = ConfigManager.create(MessagesConfig.class)
.withConfigurer(new MultificationSerdesPack(multification))
.withConfigurer(new SerdesCommons(), new YamlSnakeYamlConfigurer())
.withBindFile(new File(dataFolder, "messages.yml"))
.withRemoveOrphans(true)
.saveDefaults()
.load(true);
config.load(true);
public class MessagesConfig {
@Description("# Welcome message")
public Notice welcomeMessage = Notice.builder()
.chat("<green>Welcome, {player}!")
.title("<gold>Welcome", "<yellow>Enjoy your stay")
.sound("minecraft:entity.player.levelup")
.build();
@Description("# Error messages")
public Notice noPermission = Notice.chat("<red>No permission!");
public Notice playerNotFound = Notice.chat("<red>Player not found!");
}
# Welcome message
welcomeMessage:
chat:
- "<green>Welcome, {player}!"
title:
title: "<gold>Welcome"
subtitle: "<yellow>Enjoy your stay"
sound: "minecraft:entity.player.levelup"
# Error messages
noPermission: "<red>No permission!"
playerNotFound: "<red>Player not found!"
Simple chat-only notices are serialized as single strings. Complex notices with multiple parts use structured YAML.
# Multi-line chat with placeholders
broadcast:
chat:
- "<gold>━━━━━━━━━━━━━━━━━━━━━"
- "<yellow>{sender}: <white>{message}"
- "<gold>━━━━━━━━━━━━━━━━━━━━━"
# Actionbar + sound
healSuccess:
actionBar: "<green>❤ Health restored"
sound: "minecraft:entity.player.levelup 1.0 1.2"
# Title + subtitle + timing
warning:
title: "<red>Warning!"
subtitle: "<gray>PvP enabled in this area"
times: "0.5s 3s 1s"
# Bossbar example
bossInfo:
bossBar:
color: "GREEN"
text: "<green>Objective updated"
progress: 0.6
These YAML snippets map directly to the Notice fields your serializers handle, so you can paste them into messages.yml for CDN or Okaeri without Java changes.