Skip to content

Repository files navigation

Multification Banner

Multification

Powerful library for sending custom notifications based on adventure.

Chat on DiscordRead the DocsGradle

About

Multification makes it simple to create customizable notifications and messages within large plugins that require handling a high volume of messages (while the setup may not be easy, it’s worthwhile for extensive plugins). It offers a range of features, including:

  • 💭 Chat messages
  • 📕 Title & Subtitle
  • 🎬 ActionBar
  • 🍫 BossBar
  • 🔊 Sounds
  • 🎨 Adventure support
  • 🌈 MiniMessage support (including gradients, hex colors, hover, click and more)
  • 📥 Placeholders
  • 🛠️ Formatter support
  • 🌎 Flexible messages providing (easy to implement i18n)
  • 📦 Configuration support (CDN, Okaeri Configs)
  • 🚀 Cross-platform support (Bukkit, Paper)

Messages can be sent to any audience, such as players or the console.

Supported Platforms

PlatformModuleJava VersionAdventure APIStatus
Papermultification-paperJava 21Native (built-in)✅ Supported
Bukkit/Spigotmultification-bukkitJava 8+External adapter✅ Supported
Velocitymultification-velocityJava 21+Native✅ Supported
Coremultification-coreJava 8+Custom implementation🔨 For custom platforms

💡 Recommendation: Use multification-paper for Paper servers (1.19.4+) to leverage native Adventure API without external dependencies.

Getting Started

For Paper Servers (Recommended)

Add the following repository and dependency to your build.gradle.kts:

repositories {
maven("https://repo.eternalcode.pl/releases")
maven("https://repo.papermc.io/repository/maven-public/")
}
dependencies {
implementation("com.eternalcode:multification-paper:1.2.3")
}

For Bukkit/Spigot Servers

repositories {
maven("https://repo.eternalcode.pl/releases")
}
dependencies {
implementation("com.eternalcode:multification-bukkit:1.2.3")
}

Note: For custom platforms or other Adventure-based servers, use multification-core and implement your own platform adapter.

Quick Example

Then create a new instance of the Multification class and use it to send notifications:

publicclassYourMultificationextendsBukkitMultification<MessagesConfig> {
privatefinalMessagesConfigmessagesConfig;
privatefinalAudienceProvideraudienceProvider;
privatefinalMiniMessageminiMessage;
publicYourMultification(
MessagesConfigmessagesConfig,
AudienceProvideraudienceProvider,
MiniMessageminiMessage) {
this.messagesConfig = messagesConfig;
this.audienceProvider = audienceProvider;
this.miniMessage = miniMessage;
}
@Overrideprotected@NotNullTranslationProvider<MessagesConfig> translationProvider() {
returnlocale -> this.messagesConfig;
}
@Overrideprotected@NotNullComponentSerializer<Component, Component, String> serializer() {
returnthis.miniMessage;
}
@Overrideprotected@NotNullAudienceConverter<CommandSender> audienceConverter() {
returncommandSender -> {
if (commandSenderinstanceofPlayerplayer) {
returnthis.audienceProvider.player(player.getUniqueId());
}
returnthis.audienceProvider.console();
};
}
}

Then in init method such as onEnable, you can create a new instance of the YourMultification class and use it to send notifications:

AudienceProvideraudienceProvider = BukkitAudiences.create(this);
MiniMessageminiMessage = MiniMessage.miniMessage();
MessagesConfigmessagesConfig = newMessagesConfig();
YourMultificationmultification = newYourMultification(messagesConfig, audienceProvider, miniMessage);

After that, you can use the multification instance to send notifications:

multification.create()
.player(player.getUniqueId())
.notice(messages ->messages.yourMessage)
.send();

Configuration Support

Multification currently supports two configuration libraries:

  • CDNSimple and fast property-based configuration library for JVM apps
  • Okaeri ConfigsSimple Java/POJO config library written with love and Lombok

To use the Multification library with one of the configuration libraries, you need to:

(CDN) 1. Add dependency to your build.gradle file:

implementation("com.eternalcode:multification-cdn:1.1.4")
implementation("net.dzikoysk:cdn:1.14.5")

(CDN) 2. Create configuration class:

publicclassMessagesConfig {
@Description("# My first message")
publicNoticefirstMessage = Notice.chat("<gradient:red:blue>Multification is awesome!");
}

(CDN) 3. Create a new instance of the Cdn with the MultificationNoticeCdnComposer:

Cdncdn = CdnFactory.createYamlLike()
.getSettings()
.withComposer(Notice.class, newMultificationNoticeCdnComposer(multification.getNoticeRegistry()))
.build();

(CDN) 4. Load the configuration:

To load and create the config file, use the following code in the init method such as onEnable:

MessagesConfigmessages = newMessagesConfig();
Resourceresource = Source.of(this.dataFolder, "messages.yml");
cdn.load(resource, messages).orThrow(cause ->cause);
cdn.render(config, resource).orThrow(cause ->cause);

Checkout example with CDN! example plugin.

(Okaeri) 1. Add the following dependency to your build.gradle file:

implementation("com.eternalcode:multification-okaeri:1.1.4")

Probably also you will need to add additional dependencies for your platform, e.g. :

implementation("eu.okaeri:okaeri-configs-serdes-commons:5.0.5")
implementation("eu.okaeri:okaeri-configs-serdes-bukkit:5.0.5")
implementation("eu.okaeri:okaeri-configs-yaml-bukkit:5.0.5")

See Okaeri Configs for more information.

(Okaeri) 2. Create configuration class:

publicclassMessagesConfigextendsOkaeriConfig {
@Comment("My first message")
publicNoticefirstMessage = Notice.chat("<gradient:red:blue>Multification is awesome!");
}

(Okaeri) 3. Load the configuration:

MessagesConfigconfig = (MessagesConfig) ConfigManager.create(MessagesConfig.class)
.withConfigurer(newMultificationSerdesPack(multification.getNoticeRegistry()))
.withConfigurer(
newSerdesCommons(),
newYamlBukkitConfigurer(),
newSerdesBukkit()) // specify configurers for your platform
.withBindFile(newFile(dataFolder, "messages.yml"))
.withRemoveOrphans(true) // automatic removal of undeclared keys
.saveDefaults() // save file if does not exists
.load(true);

📄 License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

🔗 Links


Made with ❤️ by EternalCodeTeam

About

⚡ Powerful library for sending custom notifications based on adventure.

Topics

Resources

Stars

20 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages