Improved fix for players being able to inject colors into faction descriptions, usable to spoof server messages and such

This commit is contained in:
Brettflan 2011-12-18 01:25:42 -06:00
parent a7aa0d1aea
commit a9146ac27f
1 changed files with 3 additions and 3 deletions

View File

@ -32,13 +32,13 @@ public class CmdDescription extends FCommand
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if ( ! payForCommand(Conf.econCostDesc, "to change faction description", "for changing faction description")) return;
myFaction.setDescription(TextUtil.implode(args, " "));
myFaction.setDescription(TextUtil.implode(args, " ").replaceAll("(&([a-f0-9]))", "& $2")); // since "&" color tags seem to work even through plain old FPlayer.sendMessage() for some reason, we need to break those up
// Broadcast the description to everyone
for (FPlayer fplayer : FPlayers.i.getOnline())
{
fplayer.msg("<i>The faction %s<i> changed their description to:", myFaction.describeTo(fplayer));
fplayer.msg("<i>"+myFaction.getDescription());
fplayer.sendMessage(myFaction.getDescription()); // players can inject "&" or "`" or "<i>" or whatever in their description; &k is particularly interesting looking
}
}