diff --git a/src/main/java/com/gmail/nossr50/config/skills/alchemy/PotionConfig.java b/src/main/java/com/gmail/nossr50/config/skills/alchemy/PotionConfig.java index c939d2d64..515b8e3b3 100644 --- a/src/main/java/com/gmail/nossr50/config/skills/alchemy/PotionConfig.java +++ b/src/main/java/com/gmail/nossr50/config/skills/alchemy/PotionConfig.java @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.inventory.ItemStack; @@ -116,12 +117,12 @@ public class PotionConfig extends ConfigLoader { try { short dataValue = Short.parseShort(potion_section.getName()); - String name = potion_section.getString("Name"); + String name = ChatColor.translateAlternateColorCodes('&', potion_section.getString("Name")); List lore = new ArrayList(); if (potion_section.contains("Lore")) { for (String line : potion_section.getStringList("Lore")) { - lore.add(line); + lore.add(ChatColor.translateAlternateColorCodes('&', line)); } } diff --git a/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java b/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java index 7c54135b4..77ea403dd 100644 --- a/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java +++ b/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import org.bukkit.ChatColor; import org.bukkit.DyeColor; import org.bukkit.Material; import org.bukkit.configuration.ConfigurationSection; @@ -236,6 +237,22 @@ public class TreasureConfig extends ConfigLoader { try { item = new Potion(PotionType.valueOf(potionType.toUpperCase().trim())).toItemStack(amount); + + if (config.contains(type + "." + treasureName + ".Custom_Name")) { + ItemMeta itemMeta = item.getItemMeta(); + itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getString(type + "." + treasureName + ".Custom_Name"))); + item.setItemMeta(itemMeta); + } + + if (config.contains(type + "." + treasureName + ".Lore")) { + ItemMeta itemMeta = item.getItemMeta(); + List lore = new ArrayList(); + for (String s : config.getStringList(type + "." + treasureName + ".Lore")) { + lore.add(ChatColor.translateAlternateColorCodes('&', s)); + } + itemMeta.setLore(lore); + item.setItemMeta(itemMeta); + } } catch (IllegalArgumentException ex) { reason.add("Invalid Potion_Type: " + potionType); @@ -249,6 +266,22 @@ public class TreasureConfig extends ConfigLoader { dye.setColor(DyeColor.valueOf(color.toUpperCase().trim())); item = dye.toItemStack(amount); + + if (config.contains(type + "." + treasureName + ".Custom_Name")) { + ItemMeta itemMeta = item.getItemMeta(); + itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getString(type + "." + treasureName + ".Custom_Name"))); + item.setItemMeta(itemMeta); + } + + if (config.contains(type + "." + treasureName + ".Lore")) { + ItemMeta itemMeta = item.getItemMeta(); + List lore = new ArrayList(); + for (String s : config.getStringList(type + "." + treasureName + ".Lore")) { + lore.add(ChatColor.translateAlternateColorCodes('&', s)); + } + itemMeta.setLore(lore); + item.setItemMeta(itemMeta); + } } catch (IllegalArgumentException ex) { reason.add("Invalid Dye_Color: " + color); @@ -259,13 +292,17 @@ public class TreasureConfig extends ConfigLoader { if (config.contains(type + "." + treasureName + ".Custom_Name")) { ItemMeta itemMeta = item.getItemMeta(); - itemMeta.setDisplayName(config.getString(type + "." + treasureName + ".Custom_Name")); + itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getString(type + "." + treasureName + ".Custom_Name"))); item.setItemMeta(itemMeta); } if (config.contains(type + "." + treasureName + ".Lore")) { ItemMeta itemMeta = item.getItemMeta(); - itemMeta.setLore(config.getStringList(type + "." + treasureName + ".Lore")); + List lore = new ArrayList(); + for (String s : config.getStringList(type + "." + treasureName + ".Lore")) { + lore.add(ChatColor.translateAlternateColorCodes('&', s)); + } + itemMeta.setLore(lore); item.setItemMeta(itemMeta); } }