From 97f16f98c739803c7992820eae7fce03262401fb Mon Sep 17 00:00:00 2001 From: Adrian Victor Date: Tue, 19 May 2026 20:31:01 -0300 Subject: [PATCH] Fix messages in reload command --- .gitignore | 1 + build.gradle.kts | 2 +- .../github/adrianvic/itemeconomy/commands/Reload.java | 10 +++++++--- src/main/resources/messages_en.properties | 4 ++-- src/main/resources/messages_pt.properties | 4 ++-- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 9ede845..4c59a71 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ build/ out/ .idea/ libs/ +run/ \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index bbc19a2..35e0edf 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -106,4 +106,4 @@ tasks.withType { tasks.runServer { minecraftVersion("1.21") -} +} \ No newline at end of file diff --git a/src/main/java/io/github/adrianvic/itemeconomy/commands/Reload.java b/src/main/java/io/github/adrianvic/itemeconomy/commands/Reload.java index 4e5ff26..b0d8514 100644 --- a/src/main/java/io/github/adrianvic/itemeconomy/commands/Reload.java +++ b/src/main/java/io/github/adrianvic/itemeconomy/commands/Reload.java @@ -9,17 +9,21 @@ import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.jetbrains.annotations.NotNull; +import java.util.Locale; + public class Reload implements CommandExecutor { @Override public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String @NotNull [] strings) { + Locale locale = Utils.localeOrDefault(commandSender); try { - commandSender.sendMessage("[ECONOMY] %s".formatted(Messages.RELOADING)); + commandSender.sendMessage("[ECONOMY] %s".formatted(Messages.RELOADING.get(locale))); Config.loadConfig(new UnrealConfig(Main.getInstance(), Main.getInstance().getDataFolder(), "config.yml")); - commandSender.sendMessage("[ECONOMY] %s".formatted(Messages.RELOAD_FINISHED)); + commandSender.sendMessage("[ECONOMY] %s".formatted(Messages.RELOAD_FINISHED.get(locale))); return true; } catch (Exception e) { - commandSender.sendMessage("[ECONOMY] %s".formatted(Messages.RELOAD_ERROR)); + commandSender.sendMessage("[ECONOMY] %s".formatted(Messages.RELOAD_ERROR.get(locale))); + e.printStackTrace(); return false; } } diff --git a/src/main/resources/messages_en.properties b/src/main/resources/messages_en.properties index ee946e3..95f9873 100644 --- a/src/main/resources/messages_en.properties +++ b/src/main/resources/messages_en.properties @@ -9,5 +9,5 @@ pay-could-not-find-target=Could not find target player. pay-not-enough-money=You don't have enough money. pay-invalid-amount=The amount you tried to pay is not valid. reloading=Reloading... -reload-error=Reload complete. -reload-finished=An error occurred while reloading the config, please check your logs. \ No newline at end of file +reload-error=An error occurred while reloading the config, please check your logs. +reload-finished=Reload complete. \ No newline at end of file diff --git a/src/main/resources/messages_pt.properties b/src/main/resources/messages_pt.properties index be1edbc..e11dc4c 100644 --- a/src/main/resources/messages_pt.properties +++ b/src/main/resources/messages_pt.properties @@ -9,5 +9,5 @@ pay-could-not-find-target=N pay-not-enough-money=Você não tem dinheiro suficiente. pay-invalid-amount=A quantidade que você tentou enviar é inválida. reloading=Recarregando... -reload-error=Carregamento completo. -reload-finished=Ocorreu um erro ao recarregar, por favor, verifique seu registro. \ No newline at end of file +reload-error=Ocorreu um erro ao recarregar, por favor, verifique seu registro. +reload-finished=Carregamento completo. \ No newline at end of file