mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Added checking to make sure that the next character after a ^ is color code.
This commit is contained in:
parent
42b8bd8ee1
commit
d2b64044e2
@ -225,7 +225,7 @@ public class vminecraftChat {
|
|||||||
color = Colors.White;
|
color = Colors.White;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
color = Colors.White;
|
color = null;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return color;
|
return color;
|
||||||
@ -381,14 +381,24 @@ public class vminecraftChat {
|
|||||||
//Loop through looking for a color code
|
//Loop through looking for a color code
|
||||||
for(int x = 0; x< msg.length(); x++)
|
for(int x = 0; x< msg.length(); x++)
|
||||||
{
|
{
|
||||||
|
//If the char is a ^
|
||||||
if(msg.charAt(x)=='^' && x != msg.length() - 1)
|
if(msg.charAt(x)=='^' && x != msg.length() - 1)
|
||||||
|
{
|
||||||
|
//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
|
//Set the most recent color to the new color
|
||||||
recentColor = vminecraftChat.colorChange(msg.charAt(x+1));
|
recentColor = vminecraftChat.colorChange(msg.charAt(x+1));
|
||||||
|
//Add the color
|
||||||
temp += recentColor;
|
temp += recentColor;
|
||||||
|
//Skip these chars
|
||||||
x++;
|
x++;
|
||||||
|
//Otherwise ignore it.
|
||||||
|
} else {
|
||||||
|
temp += msg.charAt(x);
|
||||||
}
|
}
|
||||||
else{
|
//Insert the character
|
||||||
|
} else {
|
||||||
temp += msg.charAt(x);
|
temp += msg.charAt(x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,13 +61,12 @@ public class vminecraftCommands{
|
|||||||
if(vminecraftSettings.getInstance().cmdHeal())
|
if(vminecraftSettings.getInstance().cmdHeal())
|
||||||
{
|
{
|
||||||
//If a target wasn't specified, heal the user.
|
//If a target wasn't specified, heal the user.
|
||||||
if (args == null){
|
if (args.length < 1){
|
||||||
if (player.getHealth() < 20){
|
player.setHealth(20);
|
||||||
vminecraftChat.gmsg("Your health is restored");
|
player.sendMessage("Your health is restored");
|
||||||
}
|
|
||||||
//If a target was specified, try to find them and then heal them
|
//If a target was specified, try to find them and then heal them
|
||||||
//Otherwise report the error
|
//Otherwise report the error
|
||||||
} else if (args != null){
|
} else if (args.length > 0){
|
||||||
Player playerTarget = etc.getServer().matchPlayer(args[0]);
|
Player playerTarget = etc.getServer().matchPlayer(args[0]);
|
||||||
|
|
||||||
if (playerTarget != null){
|
if (playerTarget != null){
|
||||||
|
Loading…
Reference in New Issue
Block a user