From 7e11d0ca95e05bf5e128500e8b16d7b689b718d0 Mon Sep 17 00:00:00 2001 From: 7sat <49030779+7sat@users.noreply.github.com> Date: Tue, 19 Dec 2023 22:48:21 +0900 Subject: [PATCH] Fixed an issue where strings sometimes did not display properly if they contained "\n". --- pom.xml | 2 +- .../java/me/sat7/dynamicshop/guis/InGameUI.java | 15 ++++++++++++++- .../me/sat7/dynamicshop/guis/ShopSettings.java | 2 +- .../me/sat7/dynamicshop/utilities/LangUtil.java | 4 ++-- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index be4c421..0f6f93a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.sat7 DynamicShop - 3.16.0 + 3.16.1 jar DynamicShop diff --git a/src/main/java/me/sat7/dynamicshop/guis/InGameUI.java b/src/main/java/me/sat7/dynamicshop/guis/InGameUI.java index c859ed2..9826122 100644 --- a/src/main/java/me/sat7/dynamicshop/guis/InGameUI.java +++ b/src/main/java/me/sat7/dynamicshop/guis/InGameUI.java @@ -105,7 +105,20 @@ protected ItemStack CreateButton(int slotIndex, Material icon, String name, int @SuppressWarnings({"UnusedReturnValue", "SameParameterValue"}) protected ItemStack CreateButton(int slotIndex, Material icon, String name, ArrayList lore, int amount) { - ItemStack itemStack = ItemsUtil.createItemStack(icon, null, name, lore, amount); + ArrayList finalLore = new ArrayList<>(); + for(String loreLine : lore) + { + if (loreLine.contains("\n")) + { + finalLore.addAll(Arrays.asList(loreLine.split("\n"))); + } + else + { + finalLore.add(loreLine); + } + } + + ItemStack itemStack = ItemsUtil.createItemStack(icon, null, name, finalLore, amount); inventory.setItem(slotIndex, itemStack); return itemStack; diff --git a/src/main/java/me/sat7/dynamicshop/guis/ShopSettings.java b/src/main/java/me/sat7/dynamicshop/guis/ShopSettings.java index e273053..132da0f 100644 --- a/src/main/java/me/sat7/dynamicshop/guis/ShopSettings.java +++ b/src/main/java/me/sat7/dynamicshop/guis/ShopSettings.java @@ -371,7 +371,7 @@ public Inventory getGui(Player player, String shopName) // 거래 UI 설정 ArrayList tradeUILore = new ArrayList<>(); tradeUILore.add("§9" + t(null, "CUR_STATE") + ": " + (confSec_Options.contains("tradeUI") ? confSec_Options.get("tradeUI") : t(player,"NULL"))); - tradeUILore.add(t(player, "SHOP_SETTING.TRADE_UI_LORE")); + tradeUILore.add(t(player, "SHOP_SETTING.TRADE_UI_LORE_2")); CreateButton(TRADE_UI_SETTING, Material.EMERALD, t(player, "SHOP_SETTING.TRADE_UI"), tradeUILore); return inventory; diff --git a/src/main/java/me/sat7/dynamicshop/utilities/LangUtil.java b/src/main/java/me/sat7/dynamicshop/utilities/LangUtil.java index 91e0717..e1520ec 100644 --- a/src/main/java/me/sat7/dynamicshop/utilities/LangUtil.java +++ b/src/main/java/me/sat7/dynamicshop/utilities/LangUtil.java @@ -144,7 +144,7 @@ public static void setupLangFile(String lang) ccLang.get().addDefault("SHOP_SETTING.COMMAND_LORE1", "§e좌클릭: 설정"); ccLang.get().addDefault("SHOP_SETTING.COMMAND_LORE3", "§e씨프트 우클릭: 마지막 항목 삭제"); ccLang.get().addDefault("SHOP_SETTING.TRADE_UI", "§f거래 UI 설정"); - ccLang.get().addDefault("SHOP_SETTING.TRADE_UI_LORE", "§e좌클릭: 편집\n우클릭: 초기화"); + ccLang.get().addDefault("SHOP_SETTING.TRADE_UI_LORE_2", "§e좌클릭: 편집\n§e우클릭: 초기화"); ccLang.get().addDefault("ROTATION_EDITOR_TITLE", "§3로테이션 에디터"); ccLang.get().addDefault("ROTATION_EDITOR.ENABLED", "§a로테이션 켜짐"); @@ -596,7 +596,7 @@ public static void setupLangFile(String lang) ccLang.get().addDefault("SHOP_SETTING.COMMAND_LORE1", "§eLMB: Set"); ccLang.get().addDefault("SHOP_SETTING.COMMAND_LORE3", "§eShift RMB: Delete last item"); ccLang.get().addDefault("SHOP_SETTING.TRADE_UI", "§fEdit Trade UI"); - ccLang.get().addDefault("SHOP_SETTING.TRADE_UI_LORE", "§eLMB: Edit\nRMB: Reset"); + ccLang.get().addDefault("SHOP_SETTING.TRADE_UI_LORE_2", "§eLMB: Edit\n§eRMB: Reset"); ccLang.get().addDefault("ROTATION_EDITOR_TITLE", "§3Rotation Editor"); ccLang.get().addDefault("ROTATION_EDITOR.ENABLED", "§aEnabled");