From d9a34ee4de577add9118fa8ec0b57c0ff21133d0 Mon Sep 17 00:00:00 2001 From: Ghost_chu <2908803755@qq.com> Date: Tue, 31 Jul 2018 16:09:35 +0800 Subject: [PATCH] vanlianame not should use i18n itemname Former-commit-id: 530cea625813897b532ba8918c8258fc82bd0a0b --- .../org/maxgamer/quickshop/QuickShop.java | 44 +------------------ .../org/maxgamer/quickshop/Util/Util.java | 7 +-- 2 files changed, 4 insertions(+), 47 deletions(-) diff --git a/src/main/java/org/maxgamer/quickshop/QuickShop.java b/src/main/java/org/maxgamer/quickshop/QuickShop.java index 6cec7ebbe..4cdb63569 100644 --- a/src/main/java/org/maxgamer/quickshop/QuickShop.java +++ b/src/main/java/org/maxgamer/quickshop/QuickShop.java @@ -176,48 +176,7 @@ public class QuickShop extends JavaPlugin { getServer().getPluginManager().registerEvents(ll, this); } - if (this.getConfig().isSet("custom-items-name")) { - for (String s : this.getConfig().getStringList("custom-items-name")) { - try { - String[] mainVal = s.split("[;]"); - if (mainVal.length!=3) { - throw new Exception("Invalid format (main args length must be 3)"); - } - - String[] matVal = mainVal[0].split("[*]"); - Material material = Material.matchMaterial(matVal[0]); - if (material==null) { - throw new Exception("Invalid material: "+matVal[0]); - } - - ItemStack is; - if (matVal.length>1) { - try { - is = new ItemStack(material, 1, Short.valueOf(matVal[1])); - } catch (Exception e) { - throw new Exception("Invalid data value: "+matVal[1]); - } - } else { - is = new ItemStack(material, 1, (short) 0); - } - - if (mainVal[1].length()>16) { - Bukkit.getLogger().warning("Custom item name definition {"+s+"} sign name is longer than 16 characters. Only the first 16 characters will be shown."); - } - - List cinList = customItemsName.get(material); - if (cinList==null) { - cinList = new ArrayList(); - customItemsName.put(material, cinList); - } - - cinList.add(new CustomItemName(is, mainVal[1], mainVal[2])); - } catch (Exception e) { - Bukkit.getLogger().warning("Invalid custom item name definition {"+s+"} Error: "+e.getMessage()); - } - } - } - + // ConfigurationSection cPotionSection = this.getConfig().getConfigurationSection("custom-potions-name"); // if (cPotionSection!=null) { // CustomPotionsName.setSignFormat(new String[]{cPotionSection.getString("sign.format"), cPotionSection.getString("sign.variety.normal"), cPotionSection.getString("sign.variety.splash"), cPotionSection.getString("sign.variety.lingering")}); @@ -326,6 +285,7 @@ public class QuickShop extends JavaPlugin { int y = 0; int z = 0; String worldName = null; + //========================================================================================== try { x = rs.getInt("x"); y = rs.getInt("y"); diff --git a/src/main/java/org/maxgamer/quickshop/Util/Util.java b/src/main/java/org/maxgamer/quickshop/Util/Util.java index 213893ffe..482e2a356 100644 --- a/src/main/java/org/maxgamer/quickshop/Util/Util.java +++ b/src/main/java/org/maxgamer/quickshop/Util/Util.java @@ -297,6 +297,7 @@ public class Util { public static ItemStack deserialize(String config) throws InvalidConfigurationException { YamlConfiguration cfg = new YamlConfiguration(); cfg.loadFromString(config); + cfg.getString("item"); ItemStack stack = cfg.getItemStack("item"); return stack; } @@ -319,7 +320,7 @@ public class Util { return customItemName.getFullName(); } - String vanillaName = MsgUtil.getItemi18n(itemStack.getType().name()); + String vanillaName = itemStack.getType().name(); return prettifyText(vanillaName); } @@ -353,10 +354,6 @@ public class Util { ItemStack is = itemStack.clone(); is.setAmount(1); - CustomItemName customItemName = QuickShop.instance.getCustomItemNames(is); - if (customItemName!=null) { - return customItemName.getSignName(); - } String name = MsgUtil.getItemi18n(itemStack.getType().name());