From 3839e1d6cd7a39d93a1c5957e36a36d60c843c96 Mon Sep 17 00:00:00 2001 From: Verni Date: Tue, 22 Oct 2024 23:12:35 +0200 Subject: [PATCH 1/3] Extract prefix to static variable in notifications. --- eternaleconomy-core/build.gradle.kts | 3 ++ .../cooldown/CommandCooldownConfig.java | 6 ++- .../messages/MessageAdminSubSection.java | 37 ++++++++------- .../messages/MessageConfig.java | 17 ++++--- .../messages/MessagesPlayerSubSection.java | 47 ++++++++++--------- 5 files changed, 62 insertions(+), 48 deletions(-) diff --git a/eternaleconomy-core/build.gradle.kts b/eternaleconomy-core/build.gradle.kts index add80cc..bf425ed 100644 --- a/eternaleconomy-core/build.gradle.kts +++ b/eternaleconomy-core/build.gradle.kts @@ -78,6 +78,9 @@ bukkit { tasks.runServer { minecraftVersion("1.21.1") + downloadPlugins { + github("MilkBowl", "Vault", "1.7.3", "Vault.jar") + } } tasks.shadowJar { diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/cooldown/CommandCooldownConfig.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/cooldown/CommandCooldownConfig.java index bfedef9..779e5ab 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/cooldown/CommandCooldownConfig.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/cooldown/CommandCooldownConfig.java @@ -1,19 +1,21 @@ package com.eternalcode.economy.command.cooldown; +import com.eternalcode.economy.config.implementation.messages.MessageConfig; import com.eternalcode.multification.notice.Notice; import eu.okaeri.configs.OkaeriConfig; import eu.okaeri.configs.annotation.Comment; import java.time.Duration; +import static com.eternalcode.economy.config.implementation.messages.MessageConfig.*; + public class CommandCooldownConfig extends OkaeriConfig { @Comment("Duration of the cooldown (e.g. 5s, 10m, 1h)") public Duration duration = Duration.ofSeconds(5); @Comment("Permission for admins to bypass the cooldown") public String bypassPermission = "eternaleconomy.player.pay.bypass"; public Notice message = Notice.builder() - .chat("ECONOMY " - + "You must wait {TIME} before using /pay again.") + .chat(messagesPrefix + "You must wait {TIME} before using /pay again.") .actionBar("Wait {TIME}!") .build(); } diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessageAdminSubSection.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessageAdminSubSection.java index f7c581d..7b89c58 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessageAdminSubSection.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessageAdminSubSection.java @@ -4,27 +4,30 @@ import eu.okaeri.configs.OkaeriConfig; import eu.okaeri.configs.annotation.Header; +import static com.eternalcode.economy.config.implementation.messages.MessageConfig.*; + @Header("Messages for the admin section.") public class MessageAdminSubSection extends OkaeriConfig { public Notice insufficientFunds = - Notice.chat("ECONOMY " - + "Player {PLAYER} has insufficient funds, they are missing {MISSING_BALANCE}."); - - public Notice added = Notice.chat("ECONOMY " - + "Added {AMOUNT} to " - + "{PLAYER}."); - public Notice removed = Notice.chat("ECONOMY " - + " Removed {AMOUNT} from " - + "{PLAYER}."); - public Notice set = Notice.chat("ECONOMY " - + "Set {PLAYER}'s balance to " - + "{AMOUNT}."); - public Notice reset = Notice.chat("ECONOMY " - + "Reset {PLAYER}'s balance."); - public Notice balance = Notice.chat("ECONOMY " - + " {PLAYER}'s balance is " - + "{BALANCE}."); + Notice.chat(messagesPrefix + "Player {PLAYER} has insufficient funds," + + "they are missing {MISSING_BALANCE}."); + + + public Notice added = + Notice.chat(messagesPrefix + "Added {AMOUNT} to " + + "{PLAYER}."); + public Notice removed = + Notice.chat(messagesPrefix + " Removed {AMOUNT} from " + + "{PLAYER}."); + public Notice set = + Notice.chat(messagesPrefix + "Set {PLAYER}'s balance to " + + "{AMOUNT}."); + public Notice reset = + Notice.chat(messagesPrefix + "Reset {PLAYER}'s balance."); + public Notice balance = + Notice.chat(messagesPrefix + " {PLAYER}'s balance is " + + "{BALANCE}."); } diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessageConfig.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessageConfig.java index 5ebeef7..a025aa0 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessageConfig.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessageConfig.java @@ -2,24 +2,27 @@ import com.eternalcode.multification.notice.Notice; import eu.okaeri.configs.OkaeriConfig; +import eu.okaeri.configs.annotation.Comment; @SuppressWarnings({"FieldMayBeFinal", "FieldCanBeLocal"}) public class MessageConfig extends OkaeriConfig { - + @Comment("Messages prefix") + public static String messagesPrefix = + "ECONOMY "; public Notice invalidAmount = Notice.chat( - "ECONOMY Invalid amount, please provide a valid number."); + messagesPrefix + "Invalid amount, please provide a valid number."); public Notice invalidPlayer = Notice.chat( - "ECONOMY Invalid player, please provide a valid player."); + messagesPrefix + "Invalid player, please provide a valid player."); public Notice notSender = Notice.chat( - "ECONOMY You cannot perform this action on yourself."); + messagesPrefix + "You cannot perform this action on yourself."); public Notice correctUsage = - Notice.chat("ECONOMY Correct usage:"); + Notice.chat(messagesPrefix + "Correct usage:"); public Notice correctUsageHeader = Notice.chat(" &fCorrect usage:"); public Notice correctUsageEntry = Notice.chat(" &f{USAGE}"); - public Notice missingPermission = Notice.chat( - "ECONOMY Missing permission: {PERMISSION}."); + public Notice missingPermission = + Notice.chat(messagesPrefix + "Missing permission: {PERMISSION}."); public MessageAdminSubSection admin = new MessageAdminSubSection(); public MessagesPlayerSubSection player = new MessagesPlayerSubSection(); diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessagesPlayerSubSection.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessagesPlayerSubSection.java index dd0d7a5..e4810ff 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessagesPlayerSubSection.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessagesPlayerSubSection.java @@ -3,30 +3,33 @@ import com.eternalcode.multification.notice.Notice; import eu.okaeri.configs.OkaeriConfig; +import static com.eternalcode.economy.config.implementation.messages.MessageConfig.*; + public class MessagesPlayerSubSection extends OkaeriConfig { - public Notice added = Notice.chat("ECONOMY " - + "Added {AMOUNT} to your account."); - public Notice removed = Notice.chat("ECONOMY " - + " Removed {AMOUNT} from your account."); - public Notice set = Notice.chat("ECONOMY " - + "Set your balance to {AMOUNT}."); - public Notice reset = Notice.chat("ECONOMY " - + "Resetted your balance."); - public Notice balance = Notice.chat("ECONOMY " - + " Your balance is {BALANCE}."); + public Notice added = + Notice.chat(messagesPrefix + "Added {AMOUNT}" + + "to your account."); + public Notice removed = + Notice.chat(messagesPrefix + " Removed {AMOUNT}" + + "from your account."); + public Notice set = + Notice.chat(messagesPrefix + "Set your balance to {AMOUNT}."); + public Notice reset = + Notice.chat(messagesPrefix + "Your balance was reset."); + public Notice balance = + Notice.chat(messagesPrefix + " Your balance is {BALANCE}."); public Notice balanceOther = - Notice.chat("ECONOMY " - + " {PLAYER}'s balance is {BALANCE}."); - public Notice insufficientBalance = Notice.chat("ECONOMY " - + " Insufficient funds," + Notice.chat(messagesPrefix + " {PLAYER}'s balance is" + + "{BALANCE}."); + public Notice insufficientBalance = Notice.chat(messagesPrefix + "Insufficient funds," + " you are missing {MISSING_BALANCE}."); - public Notice transferSuccess = Notice.chat("ECONOMY Successfully transferred {AMOUNT} to " - + "{PLAYER}."); - public Notice transferReceived = Notice.chat("ECONOMY " - + " Received {AMOUNT} from " - + "{PLAYER}."); - public Notice transferLimit = Notice.chat("ECONOMY " - + " Transaction limit is {LIMIT}."); + public Notice transferSuccess = + Notice.chat(messagesPrefix + "Successfully transferred {AMOUNT} to " + + "{PLAYER}."); + public Notice transferReceived = + Notice.chat(messagesPrefix + "Received {AMOUNT} from " + + "{PLAYER}."); + public Notice transferLimit = + Notice.chat(messagesPrefix + "Transaction limit is {LIMIT}."); } From 5eee01cc7d37239033ef81347cbe9d601b48af1b Mon Sep 17 00:00:00 2001 From: Verni Date: Sat, 8 Feb 2025 23:25:46 +0100 Subject: [PATCH 2/3] Prefix refactor. --- .../economy/EconomyBukkitPlugin.java | 22 +++--- .../economy/EconomyReloadCommand.java | 5 +- .../command/admin/AdminAddCommand.java | 8 ++- .../command/admin/AdminBalanceCommand.java | 10 ++- .../command/admin/AdminRemoveCommand.java | 9 ++- .../command/admin/AdminResetCommand.java | 8 ++- .../command/admin/AdminSetCommand.java | 11 ++- .../cooldown/CommandCooldownConfig.java | 4 +- .../cooldown/CommandCooldownMessage.java | 10 ++- .../handler/InvalidUsageHandlerImpl.java | 10 ++- .../handler/MissingPermissionHandlerImpl.java | 9 ++- .../message/InvalidBigDecimalMessage.java | 6 +- .../command/player/MoneyBalanceCommand.java | 11 ++- .../command/player/MoneyTransferCommand.java | 10 ++- .../messages/MessageAdminSubSection.java | 12 ++-- .../messages/MessageConfig.java | 32 +++++---- .../messages/MessagesPlayerSubSection.java | 70 ++++++++++++------- 17 files changed, 174 insertions(+), 73 deletions(-) diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/EconomyBukkitPlugin.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/EconomyBukkitPlugin.java index 894ebeb..f33c1c2 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/EconomyBukkitPlugin.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/EconomyBukkitPlugin.java @@ -106,7 +106,7 @@ public void onEnable() { this.liteCommands = LiteBukkitFactory.builder("eternaleconomy", this, server) .extension(new LiteJakartaExtension<>(), settings -> settings - .violationMessage(Positive.class, BigDecimal.class, new InvalidBigDecimalMessage<>(noticeService)) + .violationMessage(Positive.class, BigDecimal.class, new InvalidBigDecimalMessage<>(noticeService, messageConfig)) ) .annotations(extension -> extension.validator( @@ -114,20 +114,20 @@ public void onEnable() { NotSender.class, new NotSenderValidator(messageConfig))) - .missingPermission(new MissingPermissionHandlerImpl(noticeService)) - .invalidUsage(new InvalidUsageHandlerImpl(noticeService)) + .missingPermission(new MissingPermissionHandlerImpl(noticeService, messageConfig)) + .invalidUsage(new InvalidUsageHandlerImpl(noticeService, messageConfig)) - .message(LiteMessages.COMMAND_COOLDOWN, new CommandCooldownMessage(noticeService, commandsConfig)) + .message(LiteMessages.COMMAND_COOLDOWN, new CommandCooldownMessage(noticeService, commandsConfig, messageConfig)) .editorGlobal(new CommandCooldownEditor(commandsConfig)) .commands( - new AdminAddCommand(accountPaymentService, decimalFormatter, noticeService), - new AdminRemoveCommand(accountPaymentService, decimalFormatter, noticeService), - new AdminSetCommand(accountPaymentService, decimalFormatter, noticeService), - new AdminResetCommand(accountPaymentService, noticeService), - new AdminBalanceCommand(noticeService, decimalFormatter), - new MoneyBalanceCommand(noticeService, decimalFormatter), - new MoneyTransferCommand(accountPaymentService, decimalFormatter, noticeService, pluginConfig), + new AdminAddCommand(accountPaymentService, decimalFormatter, noticeService, messageConfig), + new AdminRemoveCommand(accountPaymentService, decimalFormatter, noticeService, messageConfig), + new AdminSetCommand(accountPaymentService, decimalFormatter, noticeService, messageConfig), + new AdminResetCommand(accountPaymentService, noticeService, messageConfig), + new AdminBalanceCommand(noticeService, decimalFormatter, messageConfig), + new MoneyBalanceCommand(noticeService, decimalFormatter, messageConfig), + new MoneyTransferCommand(accountPaymentService, decimalFormatter, noticeService, pluginConfig, messageConfig), new EconomyReloadCommand(configService, noticeService) ) diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/EconomyReloadCommand.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/EconomyReloadCommand.java index 97a45a7..bc34fd3 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/EconomyReloadCommand.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/EconomyReloadCommand.java @@ -1,6 +1,7 @@ package com.eternalcode.economy; import com.eternalcode.economy.config.ConfigService; +import com.eternalcode.economy.config.implementation.messages.MessageConfig; import com.eternalcode.economy.multification.NoticeService; import com.eternalcode.multification.notice.Notice; import com.google.common.base.Stopwatch; @@ -16,8 +17,7 @@ @Permission(EconomyPermissionConstant.ADMIN_RELOAD_PERMISSION) public class EconomyReloadCommand { - private static final Notice RELOADED = Notice.chat("ECONOMY " - + " Reloaded " + private static final Notice RELOADED = Notice.chat("{PREFIX}Reloaded " + "EternalEconomy in {TIME}ms!"); private final ConfigService configService; @@ -38,6 +38,7 @@ void execute(@Context CommandSender sender) { this.noticeService.create() .notice(RELOADED) .placeholder("{TIME}", String.valueOf(elapsed.toMillis())) + .placeholder("{PREFIX}", MessageConfig.messagesPrefix) .viewer(sender) .send(); } diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/admin/AdminAddCommand.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/admin/AdminAddCommand.java index c99e019..200abb5 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/admin/AdminAddCommand.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/admin/AdminAddCommand.java @@ -3,6 +3,7 @@ import com.eternalcode.economy.EconomyPermissionConstant; import com.eternalcode.economy.account.Account; import com.eternalcode.economy.account.AccountPaymentService; +import com.eternalcode.economy.config.implementation.messages.MessageConfig; import com.eternalcode.economy.format.DecimalFormatter; import com.eternalcode.economy.multification.NoticeService; import dev.rollczi.litecommands.annotations.argument.Arg; @@ -21,15 +22,18 @@ public class AdminAddCommand { private final AccountPaymentService accountPaymentService; private final DecimalFormatter decimalFormatter; private final NoticeService noticeService; + private final MessageConfig messageConfig; public AdminAddCommand( AccountPaymentService accountPaymentService, DecimalFormatter decimalFormatter, - NoticeService noticeService + NoticeService noticeService, + MessageConfig messageConfig ) { this.accountPaymentService = accountPaymentService; this.decimalFormatter = decimalFormatter; this.noticeService = noticeService; + this.messageConfig = messageConfig; } @Execute @@ -40,6 +44,7 @@ void execute(@Context CommandSender sender, @Arg Account receiver, @Arg @Positiv .notice(notice -> notice.admin.added) .placeholder("{AMOUNT}", this.decimalFormatter.format(amount)) .placeholder("{PLAYER}", receiver.name()) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .viewer(sender) .send(); @@ -47,6 +52,7 @@ void execute(@Context CommandSender sender, @Arg Account receiver, @Arg @Positiv .notice(notice -> notice.player.added) .placeholder("{AMOUNT}", this.decimalFormatter.format(amount)) .placeholder("{PLAYER}", receiver.name()) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .player(receiver.uuid()) .send(); } diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/admin/AdminBalanceCommand.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/admin/AdminBalanceCommand.java index 76c9892..1137e15 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/admin/AdminBalanceCommand.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/admin/AdminBalanceCommand.java @@ -2,6 +2,7 @@ import com.eternalcode.economy.EconomyPermissionConstant; import com.eternalcode.economy.account.Account; +import com.eternalcode.economy.config.implementation.messages.MessageConfig; import com.eternalcode.economy.format.DecimalFormatter; import com.eternalcode.economy.multification.NoticeService; import dev.rollczi.litecommands.annotations.argument.Arg; @@ -17,10 +18,16 @@ public class AdminBalanceCommand { private final NoticeService noticeService; private final DecimalFormatter decimalFormatter; + private final MessageConfig messageConfig; - public AdminBalanceCommand(NoticeService noticeService, DecimalFormatter decimalFormatter) { + public AdminBalanceCommand( + NoticeService noticeService, + DecimalFormatter decimalFormatter, + MessageConfig messageConfig + ) { this.noticeService = noticeService; this.decimalFormatter = decimalFormatter; + this.messageConfig = messageConfig; } @Execute @@ -29,6 +36,7 @@ public void execute(@Context CommandSender sender, @Arg Account account) { .notice(notice -> notice.admin.balance) .placeholder("{BALANCE}", this.decimalFormatter.format(account.balance())) .placeholder("{PLAYER}", account.name()) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .viewer(sender) .send(); } diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/admin/AdminRemoveCommand.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/admin/AdminRemoveCommand.java index 0cec280..d1d71eb 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/admin/AdminRemoveCommand.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/admin/AdminRemoveCommand.java @@ -3,6 +3,7 @@ import com.eternalcode.economy.EconomyPermissionConstant; import com.eternalcode.economy.account.Account; import com.eternalcode.economy.account.AccountPaymentService; +import com.eternalcode.economy.config.implementation.messages.MessageConfig; import com.eternalcode.economy.format.DecimalFormatter; import com.eternalcode.economy.multification.NoticeService; import dev.rollczi.litecommands.annotations.argument.Arg; @@ -21,15 +22,18 @@ public class AdminRemoveCommand { private final AccountPaymentService accountPaymentService; private final DecimalFormatter decimalFormatter; private final NoticeService noticeService; + private final MessageConfig messageConfig; public AdminRemoveCommand( AccountPaymentService accountPaymentService, DecimalFormatter decimalFormatter, - NoticeService noticeService + NoticeService noticeService, + MessageConfig messageConfig ) { this.accountPaymentService = accountPaymentService; this.decimalFormatter = decimalFormatter; this.noticeService = noticeService; + this.messageConfig = messageConfig; } @Execute @@ -40,6 +44,7 @@ void execute(@Context CommandSender sender, @Arg Account receiver, @Arg @Positiv .notice(notice -> notice.admin.insufficientFunds) .placeholder("{PLAYER}", receiver.name()) .placeholder("{MISSING_BALANCE}", this.decimalFormatter.format(subtract)) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .viewer(sender) .send(); @@ -52,12 +57,14 @@ void execute(@Context CommandSender sender, @Arg Account receiver, @Arg @Positiv .notice(notice -> notice.admin.removed) .placeholder("{AMOUNT}", this.decimalFormatter.format(amount)) .placeholder("{PLAYER}", receiver.name()) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .viewer(sender) .send(); this.noticeService.create() .notice(notice -> notice.player.removed) .placeholder("{AMOUNT}", this.decimalFormatter.format(amount)) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .placeholder("{PLAYER}", receiver.name()) .player(receiver.uuid()) .send(); diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/admin/AdminResetCommand.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/admin/AdminResetCommand.java index 887c655..ba118e3 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/admin/AdminResetCommand.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/admin/AdminResetCommand.java @@ -3,6 +3,7 @@ import com.eternalcode.economy.EconomyPermissionConstant; import com.eternalcode.economy.account.Account; import com.eternalcode.economy.account.AccountPaymentService; +import com.eternalcode.economy.config.implementation.messages.MessageConfig; import com.eternalcode.economy.multification.NoticeService; import dev.rollczi.litecommands.annotations.argument.Arg; import dev.rollczi.litecommands.annotations.command.Command; @@ -17,13 +18,16 @@ public class AdminResetCommand { private final AccountPaymentService accountPaymentService; private final NoticeService noticeService; + private final MessageConfig messageConfig; public AdminResetCommand( AccountPaymentService accountPaymentService, - NoticeService noticeService + NoticeService noticeService, + MessageConfig messageConfig ) { this.accountPaymentService = accountPaymentService; this.noticeService = noticeService; + this.messageConfig = messageConfig; } @Execute @@ -33,12 +37,14 @@ void execute(@Context CommandSender sender, @Arg Account receiver) { this.noticeService.create() .notice(notice -> notice.admin.reset) .placeholder("{PLAYER}", receiver.name()) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .viewer(sender) .send(); this.noticeService.create() .notice(notice -> notice.player.reset) .placeholder("{PLAYER}", receiver.name()) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .player(receiver.uuid()) .send(); } diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/admin/AdminSetCommand.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/admin/AdminSetCommand.java index b2bef5e..84df3a9 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/admin/AdminSetCommand.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/admin/AdminSetCommand.java @@ -3,6 +3,7 @@ import com.eternalcode.economy.EconomyPermissionConstant; import com.eternalcode.economy.account.Account; import com.eternalcode.economy.account.AccountPaymentService; +import com.eternalcode.economy.config.implementation.messages.MessageConfig; import com.eternalcode.economy.format.DecimalFormatter; import com.eternalcode.economy.multification.NoticeService; import dev.rollczi.litecommands.annotations.argument.Arg; @@ -11,9 +12,10 @@ import dev.rollczi.litecommands.annotations.execute.Execute; import dev.rollczi.litecommands.annotations.permission.Permission; import jakarta.validation.constraints.Positive; -import java.math.BigDecimal; import org.bukkit.command.CommandSender; +import java.math.BigDecimal; + @Command(name = "economy admin set") @Permission(EconomyPermissionConstant.ADMIN_SET_PERMISSION) public class AdminSetCommand { @@ -21,15 +23,18 @@ public class AdminSetCommand { private final AccountPaymentService accountPaymentService; private final DecimalFormatter decimalFormatter; private final NoticeService noticeService; + private final MessageConfig messageConfig; public AdminSetCommand( AccountPaymentService accountPaymentService, DecimalFormatter decimalFormatter, - NoticeService noticeService + NoticeService noticeService, + MessageConfig messageConfig ) { this.accountPaymentService = accountPaymentService; this.decimalFormatter = decimalFormatter; this.noticeService = noticeService; + this.messageConfig = messageConfig; } @Execute @@ -40,6 +45,7 @@ void execute(@Context CommandSender sender, @Arg Account receiver, @Arg @Positiv .notice(notice -> notice.admin.set) .placeholder("{AMOUNT}", this.decimalFormatter.format(amount)) .placeholder("{PLAYER}", receiver.name()) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .viewer(sender) .send(); @@ -47,6 +53,7 @@ void execute(@Context CommandSender sender, @Arg Account receiver, @Arg @Positiv .notice(notice -> notice.player.set) .placeholder("{AMOUNT}", this.decimalFormatter.format(amount)) .placeholder("{PLAYER}", receiver.name()) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .player(receiver.uuid()) .send(); } diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/cooldown/CommandCooldownConfig.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/cooldown/CommandCooldownConfig.java index 779e5ab..4bad4d2 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/cooldown/CommandCooldownConfig.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/cooldown/CommandCooldownConfig.java @@ -1,13 +1,11 @@ package com.eternalcode.economy.command.cooldown; -import com.eternalcode.economy.config.implementation.messages.MessageConfig; import com.eternalcode.multification.notice.Notice; import eu.okaeri.configs.OkaeriConfig; import eu.okaeri.configs.annotation.Comment; import java.time.Duration; -import static com.eternalcode.economy.config.implementation.messages.MessageConfig.*; public class CommandCooldownConfig extends OkaeriConfig { @Comment("Duration of the cooldown (e.g. 5s, 10m, 1h)") @@ -15,7 +13,7 @@ public class CommandCooldownConfig extends OkaeriConfig { @Comment("Permission for admins to bypass the cooldown") public String bypassPermission = "eternaleconomy.player.pay.bypass"; public Notice message = Notice.builder() - .chat(messagesPrefix + "You must wait {TIME} before using /pay again.") + .chat("{PREFIX}You must wait {TIME} before using /pay again.") .actionBar("Wait {TIME}!") .build(); } diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/cooldown/CommandCooldownMessage.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/cooldown/CommandCooldownMessage.java index 9dcd914..9a8c5b2 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/cooldown/CommandCooldownMessage.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/cooldown/CommandCooldownMessage.java @@ -1,6 +1,7 @@ package com.eternalcode.economy.command.cooldown; import com.eternalcode.economy.config.implementation.CommandsConfig; +import com.eternalcode.economy.config.implementation.messages.MessageConfig; import com.eternalcode.economy.multification.NoticeService; import dev.rollczi.litecommands.cooldown.CooldownState; import dev.rollczi.litecommands.invocation.Invocation; @@ -15,10 +16,16 @@ public class CommandCooldownMessage implements InvokedMessage invocation, CooldownState cooldownSt return noticeService.create() .notice(notice -> cooldown.message) .placeholder("{TIME}", formatted) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .viewer(invocation.sender()); } diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/handler/InvalidUsageHandlerImpl.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/handler/InvalidUsageHandlerImpl.java index 3c218bc..ce6b5e5 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/handler/InvalidUsageHandlerImpl.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/handler/InvalidUsageHandlerImpl.java @@ -1,5 +1,6 @@ package com.eternalcode.economy.command.handler; +import com.eternalcode.economy.config.implementation.messages.MessageConfig; import com.eternalcode.economy.multification.NoticeService; import dev.rollczi.litecommands.handler.result.ResultHandlerChain; import dev.rollczi.litecommands.invalidusage.InvalidUsage; @@ -11,9 +12,14 @@ public class InvalidUsageHandlerImpl implements InvalidUsageHandler { private final NoticeService noticeService; + private final MessageConfig messageConfig; - public InvalidUsageHandlerImpl(NoticeService noticeService) { + public InvalidUsageHandlerImpl( + NoticeService noticeService, + MessageConfig messageConfig + ) { this.noticeService = noticeService; + this.messageConfig = messageConfig; } @Override @@ -28,6 +34,7 @@ public void handle( .viewer(invocation.sender()) .notice(notice -> notice.correctUsage) .placeholder("{USAGE}", schematic.first()) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .send(); } @@ -41,6 +48,7 @@ public void handle( .viewer(invocation.sender()) .notice(notice -> notice.correctUsageEntry) .placeholder("{USAGE}", usage) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .send(); } } diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/handler/MissingPermissionHandlerImpl.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/handler/MissingPermissionHandlerImpl.java index cde09b2..481acf9 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/handler/MissingPermissionHandlerImpl.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/handler/MissingPermissionHandlerImpl.java @@ -1,5 +1,6 @@ package com.eternalcode.economy.command.handler; +import com.eternalcode.economy.config.implementation.messages.MessageConfig; import com.eternalcode.economy.multification.NoticeService; import dev.rollczi.litecommands.handler.result.ResultHandlerChain; import dev.rollczi.litecommands.invocation.Invocation; @@ -10,9 +11,14 @@ public class MissingPermissionHandlerImpl implements MissingPermissionsHandler { private final NoticeService noticeService; + private final MessageConfig messageConfig; - public MissingPermissionHandlerImpl(NoticeService noticeService) { + public MissingPermissionHandlerImpl( + NoticeService noticeService, + MessageConfig messageConfig) + { this.noticeService = noticeService; + this.messageConfig = messageConfig; } @Override @@ -26,6 +32,7 @@ public void handle( .viewer(invocation.sender()) .notice(notice -> notice.missingPermission) .placeholder("{PERMISSION}", joinedText) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .send(); } } diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/message/InvalidBigDecimalMessage.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/message/InvalidBigDecimalMessage.java index 425d232..4f7d3f5 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/message/InvalidBigDecimalMessage.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/message/InvalidBigDecimalMessage.java @@ -1,5 +1,6 @@ package com.eternalcode.economy.command.message; +import com.eternalcode.economy.config.implementation.messages.MessageConfig; import com.eternalcode.economy.multification.NoticeService; import dev.rollczi.litecommands.invocation.Invocation; import dev.rollczi.litecommands.jakarta.JakartaViolation; @@ -11,9 +12,11 @@ public class InvalidBigDecimalMessage implements InvokedMessage> { private final NoticeService noticeService; + private final MessageConfig messageConfig; - public InvalidBigDecimalMessage(NoticeService noticeService) { + public InvalidBigDecimalMessage(NoticeService noticeService, MessageConfig messageConfig) { this.noticeService = noticeService; + this.messageConfig = messageConfig; } @Override @@ -23,6 +26,7 @@ public Object get(Invocation invocation, JakartaViolation notice.invalidAmount) .placeholder("{AMOUNT}", invalidValue.toString()) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .viewer(invocation.sender()); } } diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/player/MoneyBalanceCommand.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/player/MoneyBalanceCommand.java index 69f6e60..a70c9b3 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/player/MoneyBalanceCommand.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/player/MoneyBalanceCommand.java @@ -2,6 +2,7 @@ import com.eternalcode.economy.EconomyPermissionConstant; import com.eternalcode.economy.account.Account; +import com.eternalcode.economy.config.implementation.messages.MessageConfig; import com.eternalcode.economy.format.DecimalFormatter; import com.eternalcode.economy.multification.NoticeService; import dev.rollczi.litecommands.annotations.argument.Arg; @@ -17,10 +18,16 @@ public class MoneyBalanceCommand { private final NoticeService noticeService; private final DecimalFormatter decimalFormatter; + private final MessageConfig messageConfig; - public MoneyBalanceCommand(NoticeService noticeService, DecimalFormatter decimalFormatter) { + public MoneyBalanceCommand( + NoticeService noticeService, + DecimalFormatter decimalFormatter, + MessageConfig messageConfig + ) { this.noticeService = noticeService; this.decimalFormatter = decimalFormatter; + this.messageConfig = messageConfig; } @Execute @@ -28,6 +35,7 @@ void execute(@Context Account account) { this.noticeService.create() .notice(messageConfig -> messageConfig.player.balance) .placeholder("{BALANCE}", this.decimalFormatter.format(account.balance())) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .player(account.uuid()) .send(); } @@ -39,6 +47,7 @@ void execute(@Context CommandSender sender, @Arg Account account) { .notice(messageConfig -> messageConfig.player.balanceOther) .placeholder("{PLAYER}", account.name()) .placeholder("{BALANCE}", this.decimalFormatter.format(account.balance())) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .viewer(sender) .send(); } diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/player/MoneyTransferCommand.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/player/MoneyTransferCommand.java index 77b87d5..6c10669 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/player/MoneyTransferCommand.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/command/player/MoneyTransferCommand.java @@ -5,6 +5,7 @@ import com.eternalcode.economy.account.AccountPaymentService; import com.eternalcode.economy.command.validator.notsender.NotSender; import com.eternalcode.economy.config.implementation.PluginConfig; +import com.eternalcode.economy.config.implementation.messages.MessageConfig; import com.eternalcode.economy.format.DecimalFormatter; import com.eternalcode.economy.multification.NoticeService; import dev.rollczi.litecommands.annotations.argument.Arg; @@ -23,17 +24,20 @@ public class MoneyTransferCommand { private final DecimalFormatter decimalFormatter; private final NoticeService noticeService; private PluginConfig pluginConfig; + private final MessageConfig messageConfig; public MoneyTransferCommand( AccountPaymentService accountPaymentService, DecimalFormatter decimalFormatter, NoticeService noticeService, - PluginConfig pluginConfig + PluginConfig pluginConfig, + MessageConfig messageConfig ) { this.accountPaymentService = accountPaymentService; this.decimalFormatter = decimalFormatter; this.noticeService = noticeService; this.pluginConfig = pluginConfig; + this.messageConfig = messageConfig; } @Execute @@ -43,6 +47,7 @@ void execute(@Context Account payer, @Arg @NotSender Account receiver, @Arg @Pos this.noticeService.create() .notice(notice -> notice.player.insufficientBalance) .placeholder("{MISSING_BALANCE}", this.decimalFormatter.format(subtract)) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .player(payer.uuid()) .send(); @@ -53,6 +58,7 @@ void execute(@Context Account payer, @Arg @NotSender Account receiver, @Arg @Pos this.noticeService.create() .notice(notice -> notice.player.transferLimit) .placeholder("{LIMIT}", this.decimalFormatter.format(this.pluginConfig.transactionLimit)) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .player(payer.uuid()) .send(); @@ -65,6 +71,7 @@ void execute(@Context Account payer, @Arg @NotSender Account receiver, @Arg @Pos .notice(notice -> notice.player.transferSuccess) .placeholder("{AMOUNT}", this.decimalFormatter.format(amount)) .placeholder("{PLAYER}", receiver.name()) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .player(payer.uuid()) .send(); @@ -72,6 +79,7 @@ void execute(@Context Account payer, @Arg @NotSender Account receiver, @Arg @Pos .notice(notice -> notice.player.transferReceived) .placeholder("{AMOUNT}", this.decimalFormatter.format(amount)) .placeholder("{PLAYER}", payer.name()) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .player(receiver.uuid()) .send(); } diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessageAdminSubSection.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessageAdminSubSection.java index 7b89c58..d7f60fa 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessageAdminSubSection.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessageAdminSubSection.java @@ -10,23 +10,23 @@ public class MessageAdminSubSection extends OkaeriConfig { public Notice insufficientFunds = - Notice.chat(messagesPrefix + "Player {PLAYER} has insufficient funds," + Notice.chat( "{PREFIX}Player {PLAYER} has insufficient funds," + "they are missing {MISSING_BALANCE}."); public Notice added = - Notice.chat(messagesPrefix + "Added {AMOUNT} to " + Notice.chat( "{PREFIX}Added {AMOUNT} to " + "{PLAYER}."); public Notice removed = - Notice.chat(messagesPrefix + " Removed {AMOUNT} from " + Notice.chat("{PREFIX}Removed {AMOUNT} from " + "{PLAYER}."); public Notice set = - Notice.chat(messagesPrefix + "Set {PLAYER}'s balance to " + Notice.chat( "{PREFIX}Set {PLAYER}'s balance to " + "{AMOUNT}."); public Notice reset = - Notice.chat(messagesPrefix + "Reset {PLAYER}'s balance."); + Notice.chat("{PREFIX}Reset {PLAYER}'s balance."); public Notice balance = - Notice.chat(messagesPrefix + " {PLAYER}'s balance is " + Notice.chat("{PREFIX}{PLAYER}'s balance is " + "{BALANCE}."); } diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessageConfig.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessageConfig.java index a025aa0..7250bf3 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessageConfig.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessageConfig.java @@ -7,22 +7,30 @@ @SuppressWarnings({"FieldMayBeFinal", "FieldCanBeLocal"}) public class MessageConfig extends OkaeriConfig { @Comment("Messages prefix") - public static String messagesPrefix = + public String messagesPrefix = "ECONOMY "; + public Notice invalidAmount = Notice.chat( - messagesPrefix + "Invalid amount, please provide a valid number."); + "{PREFIX}Invalid amount, please provide a valid number." + ); public Notice invalidPlayer = Notice.chat( - messagesPrefix + "Invalid player, please provide a valid player."); + "{PREFIX}Invalid player, please provide a valid player." + ); public Notice notSender = Notice.chat( - messagesPrefix + "You cannot perform this action on yourself."); - - public Notice correctUsage = - Notice.chat(messagesPrefix + "Correct usage:"); - public Notice correctUsageHeader = Notice.chat(" &fCorrect usage:"); - public Notice correctUsageEntry = Notice.chat(" &f{USAGE}"); - - public Notice missingPermission = - Notice.chat(messagesPrefix + "Missing permission: {PERMISSION}."); + "{PREFIX}You cannot perform this action on yourself." + ); + public Notice correctUsage = Notice.chat( + "{PREFIX}Correct usage:" + ); + public Notice correctUsageHeader = Notice.chat( + "{PREFIX} &fCorrect usage:" + ); + public Notice correctUsageEntry = Notice.chat( + "{PREFIX} &f{USAGE}" + ); + public Notice missingPermission = Notice.chat( + "{PREFIX}Missing permission: {PERMISSION}." + ); public MessageAdminSubSection admin = new MessageAdminSubSection(); public MessagesPlayerSubSection player = new MessagesPlayerSubSection(); diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessagesPlayerSubSection.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessagesPlayerSubSection.java index e4810ff..d40b469 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessagesPlayerSubSection.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/config/implementation/messages/MessagesPlayerSubSection.java @@ -3,33 +3,49 @@ import com.eternalcode.multification.notice.Notice; import eu.okaeri.configs.OkaeriConfig; -import static com.eternalcode.economy.config.implementation.messages.MessageConfig.*; - public class MessagesPlayerSubSection extends OkaeriConfig { - public Notice added = - Notice.chat(messagesPrefix + "Added {AMOUNT}" - + "to your account."); - public Notice removed = - Notice.chat(messagesPrefix + " Removed {AMOUNT}" - + "from your account."); - public Notice set = - Notice.chat(messagesPrefix + "Set your balance to {AMOUNT}."); - public Notice reset = - Notice.chat(messagesPrefix + "Your balance was reset."); - public Notice balance = - Notice.chat(messagesPrefix + " Your balance is {BALANCE}."); - public Notice balanceOther = - Notice.chat(messagesPrefix + " {PLAYER}'s balance is" - + "{BALANCE}."); - public Notice insufficientBalance = Notice.chat(messagesPrefix + "Insufficient funds," - + " you are missing {MISSING_BALANCE}."); - public Notice transferSuccess = - Notice.chat(messagesPrefix + "Successfully transferred {AMOUNT} to " - + "{PLAYER}."); - public Notice transferReceived = - Notice.chat(messagesPrefix + "Received {AMOUNT} from " - + "{PLAYER}."); - public Notice transferLimit = - Notice.chat(messagesPrefix + "Transaction limit is {LIMIT}."); + public Notice added = Notice.chat( + "{PREFIX}Added {AMOUNT} to your account." + ); + + public Notice removed = Notice.chat( + "{PREFIX}Removed {AMOUNT} from your account." + ); + + public Notice set = Notice.chat( + "{PREFIX}Set your balance to {AMOUNT}." + ); + + public Notice reset = Notice.chat( + "{PREFIX}Your balance was reset." + ); + + public Notice balance = Notice.chat( + "{PREFIX}Your balance is {BALANCE}." + ); + + public Notice balanceOther = Notice.chat( + "{PREFIX}{PLAYER}'s balance is " + + "{BALANCE}." + ); + + public Notice insufficientBalance = Notice.chat( + "{PREFIX}Insufficient funds, you are missing " + + "{MISSING_BALANCE}." + ); + + public Notice transferSuccess = Notice.chat( + "{PREFIX}Successfully transferred {AMOUNT} " + + "to {PLAYER}." + ); + + public Notice transferReceived = Notice.chat( + "{PREFIX}Received {AMOUNT} " + + "from {PLAYER}." + ); + + public Notice transferLimit = Notice.chat( + "{PREFIX}Transaction limit is {LIMIT}." + ); } From b4fcb85f75611af659a94143806a3d8b96082523 Mon Sep 17 00:00:00 2001 From: Verni Date: Sat, 8 Feb 2025 23:30:08 +0100 Subject: [PATCH 3/3] Reload command prefix fix. --- .../com/eternalcode/economy/EconomyBukkitPlugin.java | 2 +- .../com/eternalcode/economy/EconomyReloadCommand.java | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/EconomyBukkitPlugin.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/EconomyBukkitPlugin.java index f33c1c2..f782162 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/EconomyBukkitPlugin.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/EconomyBukkitPlugin.java @@ -128,7 +128,7 @@ public void onEnable() { new AdminBalanceCommand(noticeService, decimalFormatter, messageConfig), new MoneyBalanceCommand(noticeService, decimalFormatter, messageConfig), new MoneyTransferCommand(accountPaymentService, decimalFormatter, noticeService, pluginConfig, messageConfig), - new EconomyReloadCommand(configService, noticeService) + new EconomyReloadCommand(configService, noticeService, messageConfig) ) .context(Account.class, new AccountContext(accountManager, messageConfig)) diff --git a/eternaleconomy-core/src/main/java/com/eternalcode/economy/EconomyReloadCommand.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/EconomyReloadCommand.java index bc34fd3..a964240 100644 --- a/eternaleconomy-core/src/main/java/com/eternalcode/economy/EconomyReloadCommand.java +++ b/eternaleconomy-core/src/main/java/com/eternalcode/economy/EconomyReloadCommand.java @@ -22,10 +22,16 @@ public class EconomyReloadCommand { private final ConfigService configService; private final NoticeService noticeService; + private final MessageConfig messageConfig; - public EconomyReloadCommand(ConfigService configService, NoticeService noticeService) { + public EconomyReloadCommand( + ConfigService configService, + NoticeService noticeService, + MessageConfig messageConfig + ) { this.configService = configService; this.noticeService = noticeService; + this.messageConfig = messageConfig; } @Execute @@ -38,7 +44,7 @@ void execute(@Context CommandSender sender) { this.noticeService.create() .notice(RELOADED) .placeholder("{TIME}", String.valueOf(elapsed.toMillis())) - .placeholder("{PREFIX}", MessageConfig.messagesPrefix) + .placeholder("{PREFIX}", messageConfig.messagesPrefix) .viewer(sender) .send(); }