{
int txtEnd = m.end();
if(txtStart < txtEnd)
{
String text = sb.substring(txtStart, txtEnd);
ret.add(new TextComponent(text, currentFont, currentColor));
}
txtStart = txtEnd;
String fontFace = m.group(3);
String fontSize = m.group(4);
String colorCodeStr = m.group(7);
String colorStr = m.group(9);
if(fontFace != null)
currentFont = new Font(fontFace, currentFontStyle, currentFontSize);
if(fontSize != null)
{
currentFontSize = Integer.parseInt(fontSize);
currentFont = currentFont.deriveFont((float)currentFontSize);
}
if(colorCodeStr != null)
{
switch(Integer.parseInt(colorCodeStr))
{
case 38:
currentColor = new Color(0xff0000);
break;
case 34:
currentColor = new Color(0x00ff00);
break;
case 39:
currentColor = new Color(0xffff00);
break;
case 31:
currentColor = new Color(0x0000ff);
break;
case 36:
currentColor = new Color(0xff00ff);
break;
case 32:
currentColor = new Color(0x00ffff);
break;
case 37:
currentColor = new Color(0xff8000);
break;
case 35:
currentColor = new Color(0xff0080);
break;
case 33:
currentColor = new Color(0x808080);
break;
}
}
if(colorStr != null)
{
currentColor = new Color(Integer.parseInt(colorStr, 16));
}
}
if(txtStart < sb.length())
{
String text = sb.substring(txtStart);
ret.add(new TextComponent(text, currentFont, currentColor));
}
return (MessageComponent[]) ret.toArray(new MessageComponent[0]);
}