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/EconomyBukkitPlugin.java b/eternaleconomy-core/src/main/java/com/eternalcode/economy/EconomyBukkitPlugin.java
index 894ebeb..f782162 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,21 +114,21 @@ 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 EconomyReloadCommand(configService, noticeService)
+ 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, 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 97a45a7..a964240 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,16 +17,21 @@
@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;
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,6 +44,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 bfedef9..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
@@ -6,14 +6,14 @@
import java.time.Duration;
+
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("{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 f7c581d..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
@@ -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( "{PREFIX}Player {PLAYER} has insufficient funds,"
+ + "they are missing {MISSING_BALANCE}.");
+
+
+ public Notice added =
+ Notice.chat( "{PREFIX}Added {AMOUNT} to "
+ + "{PLAYER}.");
+ public Notice removed =
+ Notice.chat("{PREFIX}Removed {AMOUNT} from "
+ + "{PLAYER}.");
+ public Notice set =
+ Notice.chat( "{PREFIX}Set {PLAYER}'s balance to "
+ + "{AMOUNT}.");
+ public Notice reset =
+ Notice.chat("{PREFIX}Reset {PLAYER}'s balance.");
+ public Notice balance =
+ 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 5ebeef7..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
@@ -2,24 +2,35 @@
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 String messagesPrefix =
+ "ECONOMY ➤ ";
public Notice invalidAmount = Notice.chat(
- "ECONOMY ➤ Invalid amount, please provide a valid number.");
+ "{PREFIX}Invalid amount, please provide a valid number."
+ );
public Notice invalidPlayer = Notice.chat(
- "ECONOMY ➤ Invalid player, please provide a valid player.");
+ "{PREFIX}Invalid player, please provide a valid player."
+ );
public Notice notSender = Notice.chat(
- "ECONOMY ➤ You cannot perform this action on yourself.");
-
- public Notice correctUsage =
- Notice.chat("ECONOMY ➤ Correct usage:");
- public Notice correctUsageHeader = Notice.chat("➤ &fCorrect usage:");
- public Notice correctUsageEntry = Notice.chat("➤ &f{USAGE}");
-
+ "{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(
- "ECONOMY ➤ Missing permission: {PERMISSION}.");
+ "{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 dd0d7a5..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
@@ -5,28 +5,47 @@
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 balanceOther =
- Notice.chat("ECONOMY ➤"
- + " {PLAYER}'s balance is {BALANCE}.");
- public Notice insufficientBalance = Notice.chat("ECONOMY "
- + "➤ 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 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}."
+ );
}