Add messages to reload command

This commit is contained in:
天クマ 2026-05-19 19:48:01 -03:00
commit 1259cd874e
5 changed files with 21 additions and 4 deletions

View file

@ -17,7 +17,11 @@ public enum Messages {
PAY_COULD_NOT_REALIZE_TRANSACTION("pay-could-not-realize-transaction"),
PAY_COULD_NOT_FIND_TARGET("pay-could-not-find-target"),
PAY_NOT_ENOUGH_MONEY("pay-not-enough-money"),
PAY_INVALID_AMOUNT("pay-invalid-amount");
PAY_INVALID_AMOUNT("pay-invalid-amount"),
RELOADING("reloading"),
RELOAD_ERROR("reload-error"),
RELOAD_FINISHED("reload-finished");
private final String path;
Messages(String path) { this.path = path; }

View file

@ -2,6 +2,7 @@ package io.github.adrianvic.itemeconomy.commands;
import io.github.adrianvic.itemeconomy.Config;
import io.github.adrianvic.itemeconomy.Main;
import io.github.adrianvic.itemeconomy.Messages;
import io.github.adrianvic.itemeconomy.UnrealConfig;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@ -13,9 +14,12 @@ public class Reload implements CommandExecutor {
@Override
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String @NotNull [] strings) {
try {
commandSender.sendMessage("[ECONOMY] %s".formatted(Messages.RELOADING));
Config.loadConfig(new UnrealConfig(Main.getInstance(), Main.getInstance().getDataFolder(), "config.yml"));
commandSender.sendMessage("[ECONOMY] %s".formatted(Messages.RELOAD_FINISHED));
return true;
} catch (Exception e) {
commandSender.sendMessage("[ECONOMY] %s".formatted(Messages.RELOAD_ERROR));
return false;
}
}