MULTIFICATION / GUIDE

Examples

Complete working examples

Edit on GitHub

Welcome Message#

@EventHandler
public void onJoin(PlayerJoinEvent event) {
    multification.create()
        .player(event.getPlayer().getUniqueId())
        .notice(config -> config.welcomeMessage)
        .placeholder("{player}", event.getPlayer().getName())
        .send();
}

// Config
public Notice welcomeMessage = Notice.builder()
    .chat("<gradient:green:blue>Welcome, {player}!")
    .title("<rainbow>Welcome!", "<gray>Enjoy your stay")
    .sound("minecraft:entity.player.levelup")
    .build();

Command Feedback#

@Command(name = "heal")
public void heal(@Context Player player) {
    player.setHealth(20.0);

    multification.create()
        .player(player.getUniqueId())
        .notice(config -> config.healSuccess)
        .send();
}

public Notice healSuccess = Notice.builder()
    .chat("<green>You have been healed!")
    .actionBar("<green>❤ Health restored")
    .sound("minecraft:entity.player.levelup", 1.0f, 1.2f)
    .build();

Broadcast#

@Command(name = "broadcast")
public void broadcast(@Context CommandSender sender, @Arg String message) {
    multification.create()
        .all()
        .notice(config -> config.broadcast)
        .placeholder("{message}", message)
        .placeholder("{sender}", sender.getName())
        .send();
}

public Notice broadcast = Notice.builder()
    .chat(
        "<gold>━━━━━━━━━━━━━━━━━━━━━━━━━━━━",
        "<yellow>Broadcast from {sender}:",
        "<white>{message}",
        "<gold>━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
    )
    .sound("minecraft:block.note_block.pling")
    .build();

Economy Transaction#

@Command(name = "pay")
public void pay(@Context Player sender, @Arg Player target, @Arg double amount) {
    economy.withdraw(sender, amount);
    economy.deposit(target, amount);

    // Sender
    multification.create()
        .player(sender.getUniqueId())
        .notice(config -> config.paySent)
        .placeholder("{amount}", String.valueOf(amount))
        .placeholder("{player}", target.getName())
        .send();

    // Receiver
    multification.create()
        .player(target.getUniqueId())
        .notice(config -> config.payReceived)
        .placeholder("{amount}", String.valueOf(amount))
        .placeholder("{player}", sender.getName())
        .send();
}

Permission-Based#

// All players
multification.create()
    .all()
    .notice(config -> config.announcement)
    .send();

// Admins only
multification.create()
    .onlinePlayers("admin.notify")
    .notice(config -> config.adminNotify)
    .send();

Complete Examples#