1
0
mirror of https://github.com/mcMMO-Dev/mcMMO.git synced 2026-02-21 03:03:02 +01:00

Added checking to make sure that the next character after a ^ is color code.

This commit is contained in:
cerevisiae
2010-11-30 03:40:47 -06:00
parent 42b8bd8ee1
commit d2b64044e2
2 changed files with 21 additions and 12 deletions

View File

@@ -225,7 +225,7 @@ public class vminecraftChat {
color = Colors.White;
break;
default:
color = Colors.White;
color = null;
break;
}
return color;
@@ -381,14 +381,24 @@ public class vminecraftChat {
//Loop through looking for a color code
for(int x = 0; x< msg.length(); x++)
{
//If the char is a ^
if(msg.charAt(x)=='^' && x != msg.length() - 1)
{
//Set the most recent color to the new color
recentColor = vminecraftChat.colorChange(msg.charAt(x+1));
temp += recentColor;
x++;
}
else{
//If the following character is a color code
if(vminecraftChat.colorChange(msg.charAt(x+1)) != null)
{
//Set the most recent color to the new color
recentColor = vminecraftChat.colorChange(msg.charAt(x+1));
//Add the color
temp += recentColor;
//Skip these chars
x++;
//Otherwise ignore it.
} else {
temp += msg.charAt(x);
}
//Insert the character
} else {
temp += msg.charAt(x);
}
}