diff --git a/plugin.yml b/plugin.yml index 010464a..a93eeab 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ main: com.pwn9.PwnChickenLay.PwnChickenLay name: PwnChickenLay -version: 1.7 +version: 1.8 author: tremor77 description: Control the chicken egg drop event and replace it with anything you want. website: http://pwn9.com diff --git a/src/com/pwn9/PwnChickenLay/PwnChickenLay.java b/src/com/pwn9/PwnChickenLay/PwnChickenLay.java index b103757..e53f855 100644 --- a/src/com/pwn9/PwnChickenLay/PwnChickenLay.java +++ b/src/com/pwn9/PwnChickenLay/PwnChickenLay.java @@ -10,7 +10,9 @@ import java.util.List; import java.util.Random; import java.util.logging.Logger; +import java.util.stream.Collectors; +import org.bukkit.ChatColor; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.java.JavaPlugin; @@ -122,4 +124,15 @@ public static String getDate() return s; } + // function to colorize strings from the config + public static String colorize(String message) + { + return ChatColor.translateAlternateColorCodes('&', message); + } + + // function to colorize strings from the config + public static List colorize(List message) + { + return message.stream().map(s -> ChatColor.translateAlternateColorCodes('&', s)).collect(Collectors.toList()); + } } \ No newline at end of file diff --git a/src/com/pwn9/PwnChickenLay/PwnChickenLayItemSpawnListener.java b/src/com/pwn9/PwnChickenLay/PwnChickenLayItemSpawnListener.java index 8f62b47..1982e52 100644 --- a/src/com/pwn9/PwnChickenLay/PwnChickenLayItemSpawnListener.java +++ b/src/com/pwn9/PwnChickenLay/PwnChickenLayItemSpawnListener.java @@ -217,7 +217,7 @@ public void doReplacement(World eworld, Location eLoc, String randomReplacement getSpecialName = plugin.getConfig().getString("special."+specialReplacement+".name"); // set item meta display name - im.setDisplayName(getSpecialName); + im.setDisplayName(PwnChickenLay.colorize(getSpecialName)); } // Lore @@ -225,8 +225,8 @@ public void doReplacement(World eworld, Location eLoc, String randomReplacement { getSpecialLore = plugin.getConfig().getStringList("special."+specialReplacement+".lore"); - // set item meta lore - im.setLore(getSpecialLore); + // set item meta lore - colorize with list string + im.setLore(PwnChickenLay.colorize(getSpecialLore)); } // Colors (if leather)