2121
2222import lombok .EqualsAndHashCode ;
2323import lombok .ToString ;
24+ import org .apache .commons .lang .StringUtils ;
25+ import org .bukkit .ChatColor ;
2426import org .bukkit .NamespacedKey ;
2527import org .bukkit .entity .HumanEntity ;
2628import org .bukkit .entity .Player ;
@@ -49,7 +51,7 @@ public class InventoryPreview implements Listener {
4951 private static final NamespacedKey NAMESPACED_KEY = new NamespacedKey (QuickShop .getInstance (), "preview-item" );
5052 private final ItemStack itemStack ;
5153 private final QuickShop plugin = QuickShop .getInstance ();
52- private final String previewStr ;
54+ private String previewStr ;
5355 @ Nullable
5456 private Inventory inventory ;
5557
@@ -59,7 +61,7 @@ public class InventoryPreview implements Listener {
5961 * @param itemStack The item you want create.
6062 * @param plugin The plugin instance.
6163 */
62- public InventoryPreview (@ NotNull QuickShop plugin , @ NotNull ItemStack itemStack ) {
64+ public InventoryPreview (@ NotNull QuickShop plugin , @ NotNull ItemStack itemStack , @ NotNull String locale ) {
6365 Util .ensureThread (false );
6466 this .itemStack = itemStack .clone ();
6567 ItemMeta itemMeta ;
@@ -68,8 +70,10 @@ public InventoryPreview(@NotNull QuickShop plugin, @NotNull ItemStack itemStack)
6870 } else {
6971 itemMeta = plugin .getServer ().getItemFactory ().getItemMeta (itemStack .getType ());
7072 }
71- //TODO Locale
72- previewStr = "Preview Item" ;
73+ previewStr = plugin .text ().of ("quickshop-gui-preview" ).forLocale (locale );
74+ if (StringUtils .isEmpty (previewStr )) {
75+ previewStr = ChatColor .RED + "FIXME: Do not set quickshop-gui-preview to null or empty string." ;
76+ }
7377 if (itemMeta != null ) {
7478 if (itemMeta .hasLore ()) {
7579 itemMeta .getLore ().add (previewStr );
0 commit comments