### Complete Multification Command Example (Java) Source: https://context7.com/eternalcodeteam/multification/llms.txt This Java code provides a complete example of using Multification within a Bukkit command handler. The `FlyCommand` class demonstrates how to toggle flight for the player executing the command (`executeSelf`) and for another player (`executeOther`), sending appropriate messages using Multification's API. It utilizes placeholders for dynamic message content. Dependencies include `com.eternalcode.multification` and Bukkit API. ```java import com.eternalcode.multification.shared.Formatter; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class FlyCommand { private final MyMultification multification; public FlyCommand(MyMultification multification) { this.multification = multification; } // Self fly toggle public void executeSelf(Player sender) { sender.setAllowFlight(!sender.getAllowFlight()); String state = sender.getAllowFlight() ? "enabled" : "disabled"; multification.create() .player(sender.getUniqueId()) .notice(messages -> messages.selfFlyMessage) .placeholder("{state}", state) .send(); } // Toggle fly for another player public void executeOther(CommandSender sender, Player target) { target.setAllowFlight(!target.getAllowFlight()); String state = target.getAllowFlight() ? "enabled" : "disabled"; // Notify the command executor multification.create() .viewer(sender) .notice(messages -> messages.otherFlyMessage) .placeholder("{player}", target.getName()) .placeholder("{state}", state) .send(); // Notify the target player multification.create() .player(target.getUniqueId()) .notice(messages -> messages.flyTargetMessage) .placeholder("{admin}", sender.getName()) .placeholder("{state}", state) .send(); } } ``` -------------------------------- ### Use Shorthand Methods for Quick Notifications in Multification Source: https://context7.com/eternalcodeteam/multification/llms.txt Provides examples of convenience methods on the `Multification` instance for sending quick notifications. These include methods for single players, multiple players, viewers, the console, and broadcasting to all players, often with message formatting. ```java multification.player( player.getUniqueId(), messages -> messages.quickMessage, new Formatter().register("{value}", value) ); multification.players( playerUuids, messages -> messages.teamNotification, new Formatter().register("{team}", teamName) ); multification.viewer( sender, messages -> messages.commandResponse ); multification.console( messages -> messages.logMessage, new Formatter().register("{event}", eventType) ); multification.all( messages -> messages.serverMessage ); ``` -------------------------------- ### Load and Render Configuration with CDN Source: https://github.com/eternalcodeteam/multification/blob/master/README.md Shows how to load and render configuration files using the CDN library. This code is typically placed in an `onEnable` method and handles the creation and saving of configuration files like `messages.yml`. ```java MessagesConfig messages = new MessagesConfig(); Resource resource = Source.of(this.dataFolder, "messages.yml"); cdn.load(resource, messages).orThrow(cause ->cause); cdn.render(config, resource).orThrow(cause ->cause); ``` -------------------------------- ### Create Configuration Class for CDN Source: https://github.com/eternalcodeteam/multification/blob/master/README.md Defines a sample configuration class `MessagesConfig` for use with the CDN library. It includes a `Notice` field with a description, demonstrating how to structure configuration data. ```java public class MessagesConfig { @Description("# My first message") public Notice firstMessage = Notice.chat("Multification is awesome!"); } ``` -------------------------------- ### Initialize Multification and Send Notification in Java Source: https://github.com/eternalcodeteam/multification/blob/master/README.md This Java code demonstrates the initialization of Multification and sending a notification. It sets up the AudienceProvider and MiniMessage, creates an instance of the custom Multification class, and then uses it to send a message to a specific player. ```java AudienceProvider audienceProvider = BukkitAudiences.create(this); MiniMessage miniMessage = MiniMessage.miniMessage(); MessagesConfig messagesConfig = new MessagesConfig(); YourMultification multification = new YourMultification(messagesConfig, audienceProvider, miniMessage); multification.create() .player(player.getUniqueId()) .notice(messages ->messages.yourMessage) .send(); ``` -------------------------------- ### Load Configuration with Okaeri Configs and MultificationSerdesPack Source: https://github.com/eternalcodeteam/multification/blob/master/README.md This Java code shows how to load configuration using Okaeri Configs. It utilizes `ConfigManager` and integrates `MultificationSerdesPack` along with platform-specific configurers and file binding. ```java MessagesConfig config = (MessagesConfig) ConfigManager.create(MessagesConfig.class) .withConfigurer(new MultificationSerdesPack(multification.getNoticeRegistry())) .withConfigurer( new SerdesCommons(), new YamlBukkitConfigurer(), new SerdesBukkit()) // specify configurers for your platform .withBindFile(new File(dataFolder, "messages.yml")) .withRemoveOrphans(true) // automatic removal of undeclared keys .saveDefaults() // save file if does not exists .load(true); ``` -------------------------------- ### Create Configuration Class for Okaeri Configs Source: https://github.com/eternalcodeteam/multification/blob/master/README.md Defines a sample configuration class `MessagesConfig` that extends `OkaeriConfig`. This class is used with the Okaeri Configs library and includes a `Notice` field with a comment. ```java public class MessagesConfig extends OkaeriConfig { @Comment("My first message") public Notice firstMessage = Notice.chat("Multification is awesome!"); } ``` -------------------------------- ### Add Multification Bukkit Dependency to build.gradle.kts Source: https://github.com/eternalcodeteam/multification/blob/master/README.md This snippet demonstrates how to add the Multification Bukkit dependency to your build.gradle.kts file. It specifies the required repository and dependency for using Multification with Bukkit/Spigot servers. ```kotlin repositories { maven("https://repo.eternalcode.pl/releases") } dependencies { implementation("com.eternalcode:multification-bukkit:1.2.3") } ``` -------------------------------- ### Initialize CDN with MultificationNoticeCdnComposer Source: https://github.com/eternalcodeteam/multification/blob/master/README.md This Java code demonstrates initializing the CDN configuration with `MultificationNoticeCdnComposer`. This composer is essential for integrating Multification's notice system with CDN. ```java Cdn cdn = CdnFactory.createYamlLike() .getSettings() .withComposer(Notice.class, new MultificationNoticeCdnComposer(multification.getNoticeRegistry())) .build(); ``` -------------------------------- ### Plugin Initialization (Bukkit) Source: https://context7.com/eternalcodeteam/multification/llms.txt Initializes the Multification instance within a Bukkit plugin's onEnable method. It requires setting up the Adventure platform and creating necessary configuration objects. ```java import net.kyori.adventure.platform.AudienceProvider; import net.kyori.adventure.platform.bukkit.BukkitAudiences; import net.kyori.adventure.text.minimessage.MiniMessage; import org.bukkit.plugin.java.JavaPlugin; public class MyPlugin extends JavaPlugin { private AudienceProvider audienceProvider; private MyMultification multification; @Override public void onEnable() { // Initialize Adventure platform this.audienceProvider = BukkitAudiences.create(this); MiniMessage miniMessage = MiniMessage.miniMessage(); // Create messages config and multification instance MessagesConfig messagesConfig = new MessagesConfig(); this.multification = new MyMultification(messagesConfig, audienceProvider, miniMessage); // Load configuration from file ConfigurationManager configManager = new ConfigurationManager( this.getDataFolder(), multification.getNoticeRegistry() ); configManager.load(messagesConfig, "messages.yml"); } @Override public void onDisable() { if (this.audienceProvider != null) { this.audienceProvider.close(); } } } ``` -------------------------------- ### Add Multification Gradle Dependencies (Kotlin) Source: https://context7.com/eternalcodeteam/multification/llms.txt Configure your project's build.gradle.kts file to include the Multification library. This involves setting up repositories and adding specific implementation dependencies based on your server platform (Paper, Bukkit, Velocity) and desired features like CDN or Okaeri Configs support. ```kotlin // build.gradle.kts repositories { maven("https://repo.eternalcode.pl/releases") maven("https://repo.papermc.io/repository/maven-public/") } dependencies { // For Paper servers (recommended for 1.19.4+) implementation("com.eternalcode:multification-paper:1.2.3") // For Bukkit/Spigot servers implementation("com.eternalcode:multification-bukkit:1.2.3") // For Velocity proxy implementation("com.eternalcode:multification-velocity:1.2.3") // CDN configuration support implementation("com.eternalcode:multification-cdn:1.2.3") implementation("net.dzikoysk:cdn:1.14.5") // Okaeri Configs support implementation("com.eternalcode:multification-okaeri:1.2.3") implementation("eu.okaeri:okaeri-configs-serdes-commons:5.0.5") implementation("eu.okaeri:okaeri-configs-yaml-bukkit:5.0.5") } ``` -------------------------------- ### Add Okaeri Configs Dependency for Multification Source: https://github.com/eternalcodeteam/multification/blob/master/README.md This Gradle snippet illustrates how to add the `multification-okaeri` dependency. It also includes common additional dependencies required for Okaeri Configs, especially for platforms like Bukkit. ```gradle implementation("com.eternalcode:multification-okaeri:1.1.4") 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") ``` -------------------------------- ### Add Multification Paper Dependency to build.gradle.kts Source: https://github.com/eternalcodeteam/multification/blob/master/README.md This snippet shows how to add the Multification Paper dependency to your build.gradle.kts file. It includes the necessary repository and dependency declarations for integrating the library into a Paper server project. ```kotlin repositories { maven("https://repo.eternalcode.pl/releases") maven("https://repo.papermc.io/repository/maven-public/") } dependencies { implementation("com.eternalcode:multification-paper:1.2.3") } ``` -------------------------------- ### Add CDN Dependency for Multification Source: https://github.com/eternalcodeteam/multification/blob/master/README.md This snippet shows how to add the necessary Multification CDN dependency to your `build.gradle` file. It ensures that your project can utilize the CDN configuration library with Multification. ```gradle implementation("com.eternalcode:multification-cdn:1.1.4") implementation("net.dzikoysk:cdn:1.14.5") ``` -------------------------------- ### Integrate Multification with CDN Configuration (Java) Source: https://context7.com/eternalcodeteam/multification/llms.txt This Java code demonstrates how to integrate Multification with a CDN configuration library for YAML-based message storage. It sets up a `ConfigurationManager` that uses `CdnFactory` to load and save configurations, specifically handling `Notice` objects with a custom composer. Dependencies include `com.eternalcode.multification` and `net.dzikoysk.cdn`. ```java import com.eternalcode.multification.cdn.MultificationNoticeCdnComposer; import com.eternalcode.multification.notice.Notice; import com.eternalcode.multification.notice.resolver.NoticeResolverRegistry; import net.dzikoysk.cdn.Cdn; import net.dzikoysk.cdn.CdnFactory; import net.dzikoysk.cdn.reflect.Visibility; import net.dzikoysk.cdn.source.Source; import java.io.File; public class ConfigurationManager { private final Cdn cdn; private final File dataFolder; public ConfigurationManager(File dataFolder, NoticeResolverRegistry resolverRegistry) { this.dataFolder = dataFolder; this.cdn = CdnFactory.createYamlLike() .getSettings() .withComposer(Notice.class, new MultificationNoticeCdnComposer(resolverRegistry)) .withMemberResolver(Visibility.PACKAGE_PRIVATE) .build(); } public T load(T config, String fileName) { // Load existing config or use defaults this.cdn.load(Source.of(this.dataFolder, fileName), config) .orThrow(RuntimeException::new); // Save config to file (creates file if not exists) this.cdn.render(config, Source.of(this.dataFolder, fileName)) .orThrow(RuntimeException::new); return config; } public void reload(T config, String fileName) { this.cdn.load(Source.of(this.dataFolder, fileName), config) .orThrow(RuntimeException::new); } } // Usage in plugin MessagesConfig messages = new MessagesConfig(); ConfigurationManager configManager = new ConfigurationManager( getDataFolder(), multification.getNoticeRegistry() ); configManager.load(messages, "messages.yml"); ``` -------------------------------- ### Build Complex Notifications with Notice.builder() Source: https://context7.com/eternalcodeteam/multification/llms.txt Facilitates the creation of complex notifications by combining multiple types like chat, title, and sound effects using a fluent builder pattern. Supports both standard and Bukkit-specific features. Input is a series of chained method calls to define the notification components. ```java import com.eternalcode.multification.notice.Notice; import com.eternalcode.multification.bukkit.notice.BukkitNotice; import net.kyori.adventure.bossbar.BossBar; import org.bukkit.Sound; import org.bukkit.SoundCategory; import java.time.Duration; // Combining chat, title, and sound Notice complexNotice = Notice.builder() .chat("You received a gift!") .title("Gift Received!") .subtitle("Check your inventory") .times(Duration.ofMillis(500), Duration.ofSeconds(2), Duration.ofMillis(500)) .sound("entity.player.levelup", 1.0f, 1.0f) .build(); // Using BukkitNotice builder for Bukkit-specific features Notice bukkitComplexNotice = BukkitNotice.builder() .chat("Teleporting...") .actionBar("Hold still!") .sound(Sound.ENTITY_ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 2.0f, 2.0f) .build(); // Boss bar with chat notification Notice bossBarWithChat = Notice.builder() .chat("A wild boss has appeared!") .bossBar(BossBar.Color.RED, Duration.ofMinutes(5), 1.0, "Boss: {boss_name}") .build(); ``` -------------------------------- ### Advanced Formatting with Formatter (Java) Source: https://context7.com/eternalcodeteam/multification/llms.txt Utilizes the Formatter class for complex placeholder replacement scenarios, allowing registration of multiple placeholders with static values or supplier functions for dynamic content. ```java import com.eternalcode.multification.shared.Formatter; // Create a formatter with multiple placeholders Formatter formatter = new Formatter() .register("{player}", player.getName()) .register("{health}", () -> String.valueOf(player.getHealth())) .register("{level}", () -> String.valueOf(player.getLevel())); multification.create() .player(player.getUniqueId()) .notice(messages -> messages.statusMessage) .formatter(formatter) .send(); // Multiple formatters Formatter playerFormatter = new Formatter() .register("{player}", player.getName()) .register("{uuid}", player.getUniqueId().toString()); Formatter statsFormatter = new Formatter() .register("{kills}", kills) .register("{deaths}", deaths); multification.create() .viewer(sender) .notice(messages -> messages.statsDisplay) .formatter(playerFormatter, statsFormatter) .send(); ``` -------------------------------- ### Send Messages Synchronously and Asynchronously with Multification Source: https://context7.com/eternalcodeteam/multification/llms.txt Demonstrates sending messages using the `send()` and `sendAsync()` methods. `send()` blocks until the operation is complete, while `sendAsync()` is non-blocking and suitable for large broadcasts. It shows targeting specific players, all players, and online players. ```java multification.create() .player(player.getUniqueId()) .notice(messages -> messages.instantMessage) .send(); multification.create() .all() .notice(messages -> messages.broadcastMessage) .sendAsync(); multification.create() .onlinePlayers() .notice(messages -> messages.serverAnnouncement) .placeholder("{event}", eventName) .sendAsync(); ``` -------------------------------- ### Integrate Multification with Okaeri Configs (Java) Source: https://context7.com/eternalcodeteam/multification/llms.txt This Java code shows how to integrate Multification with the Okaeri Configs library for advanced configuration management. It defines a `MessagesConfig` class extending `OkaeriConfig` and demonstrates loading this configuration using `ConfigManager`, including custom serdes packs for Multification notices. Dependencies include `com.eternalcode.multification` and `eu.okaeri.configs`. ```java import com.eternalcode.multification.okaeri.MultificationSerdesPack; import com.eternalcode.multification.notice.Notice; import eu.okaeri.configs.ConfigManager; import eu.okaeri.configs.OkaeriConfig; import eu.okaeri.configs.yaml.bukkit.YamlBukkitConfigurer; import eu.okaeri.configs.serdes.commons.SerdesCommons; import eu.okaeri.configs.serdes.bukkit.SerdesBukkit; import java.io.File; // Messages config extending OkaeriConfig public class MessagesConfig extends OkaeriConfig { public Notice welcomeMessage = Notice.chat("Welcome!"); public Notice errorMessage = Notice.chat("An error occurred: {error}"); } // Loading configuration MessagesConfig messagesConfig = ConfigManager.create(MessagesConfig.class, config -> { config.withConfigurer(new MultificationSerdesPack(multification.getNoticeRegistry())); config.withConfigurer(new SerdesCommons(), new YamlBukkitConfigurer(), new SerdesBukkit()); config.withBindFile(new File(dataFolder, "messages.yml")); config.withRemoveOrphans(true); config.saveDefaults(); config.load(true); }); ``` -------------------------------- ### Notice.title() and Notice.subtitle() - Displaying Titles Source: https://context7.com/eternalcodeteam/multification/llms.txt Creates notices for displaying title and subtitle text on the player's screen. Supports custom timing for fade-in, stay, and fade-out durations, and can be used to hide titles. ```java import com.eternalcode.multification.notice.Notice; import java.time.Duration; // Title only Notice titleOnly = Notice.title("Welcome!"); // Subtitle only Notice subtitleOnly = Notice.subtitle("Enjoy your stay"); // Title with subtitle Notice titleWithSubtitle = Notice.title("Level Up!", "You reached level 10"); // Title with custom timing (fadeIn, stay, fadeOut) Notice timedTitle = Notice.title( "Achievement Unlocked!", "First Kill", Duration.ofMillis(500), // fadeIn Duration.ofSeconds(3), // stay Duration.ofMillis(500) // fadeOut ); // Hide title Notice hideTitle = Notice.hideTitle(); ``` -------------------------------- ### Send Notifications to a Specific Player with NoticeBroadcast.player() Source: https://context7.com/eternalcodeteam/multification/llms.txt Enables sending notifications to a single player identified by their UUID. Supports dynamic message content through placeholders. Requires a Multification instance and player UUID. Input is a player UUID, a notice message, and optional placeholders. ```java import java.util.UUID; // Send to player by UUID UUID playerUuid = player.getUniqueId(); multification.create() .player(playerUuid) .notice(messages -> messages.welcomeMessage) .send(); // Send with placeholders multification.create() .player(player.getUniqueId()) .notice(messages -> messages.flyToggleMessage) .placeholder("{state}", player.getAllowFlight() ? "enabled" : "disabled") .send(); ``` -------------------------------- ### Define Plugin Messages with the MessagesConfig Class Source: https://context7.com/eternalcodeteam/multification/llms.txt Illustrates how to define all plugin messages within a configuration class using `Notice` fields. This class utilizes annotations for descriptions and supports various `Notice` types like chat, title, action bar, sound, and boss bars, with placeholder support. ```java import com.eternalcode.multification.bukkit.notice.BukkitNotice; import com.eternalcode.multification.notice.Notice; import net.dzikoysk.cdn.entity.Description; import net.kyori.adventure.bossbar.BossBar; import org.bukkit.Sound; import org.bukkit.SoundCategory; import java.time.Duration; public class MessagesConfig { @Description("# Fly command messages") public Notice selfFlyMessage = Notice.chat("Fly mode: {state}"); public Notice otherFlyMessage = Notice.chat( "Set fly mode for {player} to {state}." ); public Notice flyTargetMessage = BukkitNotice.builder() .chat("Your fly mode was changed by {admin}.") .sound(Sound.ENTITY_ITEM_PICKUP) .build(); @Description("# Give command messages") public Notice giveItemSender = Notice.title( "Item Given!", "{amount}x {item} to {player}" ); public Notice giveItemReceiver = BukkitNotice.builder() .title("You received an item!") .subtitle("{amount}x {item} from {giver}") .sound(Sound.ENTITY_ITEM_PICKUP) .build(); @Description("# Teleport messages") public Notice teleportMessage = BukkitNotice.builder() .actionBar("Teleported to {location}") .sound(Sound.ENTITY_ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 2.0f, 2.0f) .build(); @Description("# Timer boss bar") public Notice timerBossBar = Notice.builder() .bossBar(BossBar.Color.RED, Duration.ofSeconds(1), "Time: {time}") .build(); @Description("# Config reload message") public Notice reloadMessage = Notice.builder() .chat("Configuration reloaded successfully!") .sound("entity.player.levelup", 1.0f, 1.0f) .build(); } ``` -------------------------------- ### Implement Custom Multification Class in Java Source: https://github.com/eternalcodeteam/multification/blob/master/README.md This Java code defines a custom Multification class extending BukkitMultification. It sets up the translation provider, serializer, and audience converter, which are essential for customizing message handling and audience targeting within the Multification framework. ```java public class YourMultification extends BukkitMultification { private final MessagesConfig messagesConfig; private final AudienceProvider audienceProvider; private final MiniMessage miniMessage; public YourMultification( MessagesConfig messagesConfig, AudienceProvider audienceProvider, MiniMessage miniMessage) { this.messagesConfig = messagesConfig; this.audienceProvider = audienceProvider; this.miniMessage = miniMessage; } @Override protected @NotNull TranslationProvider translationProvider() { return locale -> this.messagesConfig; } @Override protected @NotNull ComponentSerializer serializer() { return this.miniMessage; } @Override protected @NotNull AudienceConverter audienceConverter() { return commandSender -> { if (commandSender instanceof Player player) { return this.audienceProvider.player(player.getUniqueId()); } return this.audienceProvider.console(); }; } } ``` -------------------------------- ### Create Custom Bukkit Multification Instance Source: https://context7.com/eternalcodeteam/multification/llms.txt Extends BukkitMultification to create a custom notification handler for Bukkit/Spigot plugins. Requires implementing translation provider, serializer, and audience converter. Integrates with Adventure API for message formatting and delivery. ```java import com.eternalcode.multification.adventure.AudienceConverter; import com.eternalcode.multification.bukkit.BukkitMultification; import com.eternalcode.multification.translation.TranslationProvider; import net.kyori.adventure.platform.AudienceProvider; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.serializer.ComponentSerializer; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class MyMultification extends BukkitMultification { private final MessagesConfig messagesConfig; private final AudienceProvider audienceProvider; private final MiniMessage miniMessage; public MyMultification(MessagesConfig messagesConfig, AudienceProvider audienceProvider, MiniMessage miniMessage) { this.messagesConfig = messagesConfig; this.audienceProvider = audienceProvider; this.miniMessage = miniMessage; } @Override protected TranslationProvider translationProvider() { return locale -> this.messagesConfig; } @Override protected ComponentSerializer serializer() { return this.miniMessage; } @Override protected AudienceConverter audienceConverter() { return commandSender -> { if (commandSender instanceof Player player) { return this.audienceProvider.player(player.getUniqueId()); } return this.audienceProvider.console(); }; } } ``` -------------------------------- ### Play Sound Effects with Notice.sound() Source: https://context7.com/eternalcodeteam/multification/llms.txt Enables playing sound effects to players using various constructors. Supports sound names as strings, with optional volume and pitch adjustments, and sound categories. Dependencies include Kyori Adventure API for sound components. Input can be a sound name string, or a Key object. ```java import com.eternalcode.multification.notice.Notice; import net.kyori.adventure.key.Key; import net.kyori.adventure.sound.Sound; // Sound with namespace string Notice soundByName = Notice.sound("entity.experience_orb.pickup"); // Sound with volume and pitch Notice soundWithParams = Notice.sound("entity.player.levelup", 1.0f, 1.5f); // Sound with category, volume, and pitch Notice soundWithCategory = Notice.sound( "block.note_block.pling", Sound.Source.MASTER, 1.0f, // volume 2.0f // pitch ); // Sound using Key Notice soundWithKey = Notice.sound(Key.key("minecraft", "entity.ender_dragon.death")); ``` -------------------------------- ### Send Notifications to Multiple Players with NoticeBroadcast.players() Source: https://context7.com/eternalcodeteam/multification/llms.txt Allows sending notifications to a collection of players simultaneously, identified by a list or set of UUIDs. Supports message customization with placeholders. Requires a Multification instance and a collection of player UUIDs. Input is a collection of player UUIDs, a notice message, and optional placeholders. ```java import java.util.List; import java.util.UUID; // Send to list of players List playerUuids = List.of(player1.getUniqueId(), player2.getUniqueId(), player3.getUniqueId()); multification.create() .players(playerUuids) .notice(messages -> messages.serverAnnouncement) .placeholder("{event}", "Double XP Weekend") .send(); // Send to all players in a team Set teamMembers = getTeamMembers(teamName); multification.create() .players(teamMembers) .notice(messages -> messages.teamMessage) .placeholder("{team}", teamName) .send(); ``` -------------------------------- ### Notice.chat() - Sending Chat Messages Source: https://context7.com/eternalcodeteam/multification/llms.txt Creates notices that send chat messages, supporting MiniMessage formatting for rich text. Can send single or multiple messages and be integrated into configuration classes. ```java import com.eternalcode.multification.notice.Notice; // Single chat message Notice singleMessage = Notice.chat("Welcome to the server!"); // Multiple chat messages Notice multipleMessages = Notice.chat( "Line 1: Hello!", "Line 2: How are you?", "Line 3: Have fun!" ); // Using in a messages config public class MessagesConfig { public Notice welcomeMessage = Notice.chat("Welcome to our server!"); public Notice helpMessage = Notice.chat( "Available commands:", "/help - Show this message", "/spawn - Teleport to spawn" ); } ``` -------------------------------- ### Notice.actionbar() - Sending Action Bar Messages Source: https://context7.com/eternalcodeteam/multification/llms.txt Creates notices to display messages in the action bar above the player's hotbar. Supports MiniMessage formatting and can be defined within message configuration classes. ```java import com.eternalcode.multification.notice.Notice; // Simple action bar message Notice actionBar = Notice.actionbar("+50 XP"); // Action bar in messages config public class MessagesConfig { public Notice teleportMessage = Notice.actionbar("Teleported to {location}"); public Notice combatMessage = Notice.actionbar("You are now in combat!"); } ``` -------------------------------- ### Play Bukkit-Specific Sounds with BukkitNotice.sound() Source: https://context7.com/eternalcodeteam/multification/llms.txt Provides Bukkit-specific sound notifications using native Bukkit sound enums. Allows playing sounds with optional volume, pitch, and sound category. This is intended for Bukkit/Spigot server environments. Input is a Bukkit Sound enum, with optional parameters for volume, pitch, and category. ```java import com.eternalcode.multification.bukkit.notice.BukkitNotice; import com.eternalcode.multification.notice.Notice; import org.bukkit.Sound; import org.bukkit.SoundCategory; // Simple Bukkit sound Notice simpleSound = BukkitNotice.sound(Sound.ENTITY_ITEM_PICKUP); // Bukkit sound with volume and pitch Notice paramSound = BukkitNotice.sound(Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 1.5f); // Bukkit sound with category Notice categorySound = BukkitNotice.sound( Sound.ENTITY_ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 2.0f, // volume 2.0f // pitch ); ``` -------------------------------- ### Create Custom Paper Multification Instance Source: https://context7.com/eternalcodeteam/multification/llms.txt Utilizes PaperMultification for Paper servers (1.19.4+) leveraging native Adventure API support. Implements translation provider, serializer, and audience converter for custom notification handling. No external dependencies are required for Adventure integration. ```java import com.eternalcode.multification.adventure.AudienceConverter; import com.eternalcode.multification.paper.PaperMultification; import com.eternalcode.multification.translation.TranslationProvider; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.serializer.ComponentSerializer; import org.bukkit.command.CommandSender; public class MyPaperMultification extends PaperMultification { private final MessagesConfig messagesConfig; private final MiniMessage miniMessage; public MyPaperMultification(MessagesConfig messagesConfig) { this.messagesConfig = messagesConfig; this.miniMessage = MiniMessage.miniMessage(); } @Override protected TranslationProvider translationProvider() { return locale -> this.messagesConfig; } @Override protected ComponentSerializer serializer() { return this.miniMessage; } @Override protected AudienceConverter audienceConverter() { return commandSender -> commandSender; // Paper supports Adventure natively } } ``` -------------------------------- ### Create Custom Velocity Multification Instance Source: https://context7.com/eternalcodeteam/multification/llms.txt Extends VelocityMultification to create a custom instance for Velocity proxy servers. It requires the proxy server and plugin instance, and allows for custom translation providers, serializers, and audience converters. ```java import com.eternalcode.multification.adventure.AudienceConverter; import com.eternalcode.multification.translation.TranslationProvider; import com.eternalcode.multification.velocity.VelocityMultification; import com.velocitypowered.api.command.CommandSource; import com.velocitypowered.api.proxy.ProxyServer; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.serializer.ComponentSerializer; public class MyVelocityMultification extends VelocityMultification { private final MessagesConfig messagesConfig; private final MiniMessage miniMessage; public MyVelocityMultification(Object plugin, ProxyServer server, MessagesConfig messagesConfig) { super(server, plugin); this.messagesConfig = messagesConfig; this.miniMessage = MiniMessage.miniMessage(); } @Override protected TranslationProvider translationProvider() { return locale -> this.messagesConfig; } @Override protected ComponentSerializer serializer() { return this.miniMessage; } @Override protected AudienceConverter audienceConverter() { return commandSender -> commandSender; } } ``` -------------------------------- ### Replace Placeholders in Messages (Java) Source: https://context7.com/eternalcodeteam/multification/llms.txt Replaces placeholders within notification messages with dynamic values. Supports simple string replacements, multiple placeholders, lazy evaluation using suppliers, and optional values. ```java // Simple string placeholder multification.create() .player(player.getUniqueId()) .notice(messages -> messages.balanceMessage) .placeholder("{balance}", String.valueOf(playerBalance)) .send(); // Multiple placeholders multification.create() .player(player.getUniqueId()) .notice(messages -> messages.giveItemMessage) .placeholder("{amount}", String.valueOf(amount)) .placeholder("{item}", itemName) .placeholder("{giver}", sender.getName()) .send(); // Supplier placeholder (lazy evaluation) multification.create() .player(player.getUniqueId()) .notice(messages -> messages.timeMessage) .placeholder("{time}", () -> LocalTime.now().toString()) .send(); // Optional placeholder Optional nickname = getNickname(player); multification.create() .player(player.getUniqueId()) .notice(messages -> messages.profileMessage) .placeholder("{nickname}", nickname) .send(); ``` -------------------------------- ### Create Boss Bar Notifications with Notice.bossBar() Source: https://context7.com/eternalcodeteam/multification/llms.txt Allows the creation of boss bar notifications with customizable color, overlay, duration, progress, and message content. Dependencies include Kyori Adventure API for boss bar components. Input is a series of parameters defining the boss bar's appearance and content. ```java import com.eternalcode.multification.notice.Notice; import net.kyori.adventure.bossbar.BossBar; import java.time.Duration; // Boss bar with all options Notice fullBossBar = Notice.bossBar( BossBar.Color.RED, BossBar.Overlay.PROGRESS, Duration.ofSeconds(10), 0.75, // 75% progress "Boss Health: 75%" ); // Boss bar with default overlay Notice simpleBossBar = Notice.bossBar( BossBar.Color.GREEN, Duration.ofSeconds(5), 1.0, // 100% progress "Quest Complete!" ); // Boss bar without explicit progress Notice dynamicBossBar = Notice.bossBar( BossBar.Color.PURPLE, BossBar.Overlay.NOTCHED_10, Duration.ofSeconds(30), "Event Timer: {time}" ); ``` -------------------------------- ### Send Notification to Command Sender (Java) Source: https://context7.com/eternalcodeteam/multification/llms.txt Sends notifications directly to the CommandSender, which can be a player or the console. This method is useful for targeted feedback after a command is executed. ```java import org.bukkit.command.CommandSender; // Send to command sender (works for both players and console) public void executeCommand(CommandSender sender) { multification.create() .viewer(sender) .notice(messages -> messages.commandExecutedMessage) .send(); } // Different messages based on sender type public void handleCommand(CommandSender sender, Player target) { // Message to command executor multification.create() .viewer(sender) .notice(messages -> messages.targetUpdatedMessage) .placeholder("{player}", target.getName()) .send(); // Message to target player multification.create() .player(target.getUniqueId()) .notice(messages -> messages.youWereUpdatedMessage) .placeholder("{admin}", sender.getName()) .send(); } ``` -------------------------------- ### Broadcast Notification to All (Java) Source: https://context7.com/eternalcodeteam/multification/llms.txt Broadcasts notifications to all players currently online and the server console. This is suitable for global announcements or server-wide events. ```java // Broadcast to everyone multification.create() .all() .notice(messages -> messages.serverRestartWarning) .placeholder("{time}", "5 minutes") .send(); // Server-wide announcement multification.create() .all() .notice(messages -> messages.eventStarted) .placeholder("{event}", "PvP Tournament") .send(); ``` -------------------------------- ### Send Notification to Console (Java) Source: https://context7.com/eternalcodeteam/multification/llms.txt Sends notifications exclusively to the server console. This is ideal for logging events or system messages that should not be visible to players. ```java // Send to console multification.create() .console() .notice(messages -> messages.serverStartupMessage) .send(); // Log with placeholders multification.create() .console() .notice(messages -> messages.playerJoinLog) .placeholder("{player}", player.getName()) .placeholder("{ip}", player.getAddress().getHostString()) .send(); ``` -------------------------------- ### Send Notification to Online Players (Java) Source: https://context7.com/eternalcodeteam/multification/llms.txt Sends notifications to all online players, with an option to filter recipients based on a specific permission. This allows for targeted messages to subsets of players. ```java // Send to all online players multification.create() .onlinePlayers() .notice(messages -> messages.broadcastMessage) .send(); // Send to players with specific permission multification.create() .onlinePlayers("myplugin.vip") .notice(messages -> messages.vipOnlyMessage) .placeholder("{discount}", "50%") .send(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.