package fr.pandacube.lib.core.util; public class MinecraftWebUtil { /** Convert a legacy Minecraft color coded String into HTML Format. @param */ // TODO update to support RGB colors (Bungee and Essentials notation). // See JavaScript implementation at https://www.pandacube.fr/assets/js/global.js public static String fromMinecraftColorCodeToHTML(char code_prefix, String ligne) { String color_char = "0123456789abcdefr"; String builder = ""; char currentColor = 'r'; boolean bold = false, italic = false, underlined = false, strikethrough = false; for (int i=0; i"; currentColor = Character.toLowerCase(c); } } else if (Character.toLowerCase(c) == 'l') { if (!bold) { builder += ""; bold = true; } } else if (Character.toLowerCase(c) == 'm') { if (!strikethrough) { builder += ""; strikethrough = true; } } else if (Character.toLowerCase(c) == 'n') { if (!underlined) { builder += ""; underlined = true; } } else if (Character.toLowerCase(c) == 'o') { if (!italic) { builder += ""; italic = true; } } else { builder += code_prefix + c; } } else builder += c; } return builder; } }