From 04d5f2843158fb793ea8c4011f456cce17c491f4 Mon Sep 17 00:00:00 2001 From: Altruiis <71913030+Altruiis@users.noreply.github.com> Date: Wed, 16 Feb 2022 18:30:18 -0800 Subject: [PATCH] Localize some economy messages --- src/main/java/tsp/headdb/inventory/InventoryUtils.java | 8 ++++---- src/main/resources/messages.yml | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/tsp/headdb/inventory/InventoryUtils.java b/src/main/java/tsp/headdb/inventory/InventoryUtils.java index 14fcc94..329f75b 100644 --- a/src/main/java/tsp/headdb/inventory/InventoryUtils.java +++ b/src/main/java/tsp/headdb/inventory/InventoryUtils.java @@ -312,7 +312,7 @@ public class InventoryUtils { // If economy is disabled or no plugin is present, the item is free. // Don't mention receiving it for free in this case, since it is always free. if (economy == null) { - Utils.sendMessage(player, String.format("&7You received &e%d &7x &e%s&7!", amount, description)); + Utils.sendMessage(player, String.format(localization.getMessage("noEconomy"), amount, description)); Utils.playSound(player, "noEconomy"); return true; } @@ -323,17 +323,17 @@ public class InventoryUtils { if (cost > 0) { if (economy.has(player, cost)) { economy.withdrawPlayer(player, cost); - Utils.sendMessage(player, String.format("&7You purchased &e%d &7x &e%s &7for &e%.2f&7!", amount, description, cost)); + Utils.sendMessage(player, String.format(localization.getMessage("purchasedHead"), amount, description, cost)); Utils.playSound(player, "paid"); return true; } - Utils.sendMessage(player, String.format("&cYou do not have enough to purchase &e%d &cx &e%s&7.", amount, description)); + Utils.sendMessage(player, String.format(localization.getMessage("notEnoughMoney"), amount, description)); Utils.playSound(player, "unavailable"); return false; } // Otherwise, the item is free. - Utils.sendMessage(player, String.format("&7You received &e%d &7x &e%s &7for &efree&7!", amount, description)); + Utils.sendMessage(player, String.format(localization.getMessage("free"), amount, description)); Utils.playSound(player, "free"); return true; } diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index 6fe1394..5068574 100644 --- a/src/main/resources/messages.yml +++ b/src/main/resources/messages.yml @@ -3,6 +3,10 @@ onlyPlayers: "&cOnly players may open the database." databaseOpen: "&7Opening &cHead Database" invalidPlayer: "&cPlayer is not online!" localFavorites: "&cLocal heads can not be added to favorites!" +noEconomy: "&7You received &e%d &7x &e%s&7!" +purchasedHead: "&7You purchased &e%d &7x &e%s &7for &e%.2f&7!" +notEnoughMoney: "&cYou do not have enough to purchase &e%d &cx &e%s&7." +free: "&7You received &e%d &7x &e%s &7for &efree&7!" menu: main: "&c&lHeadDB &7(%size%)"