public String applyFormat(String format, String originalFormat, Player sender)
{
format = this.applyFormat(format, originalFormat);
format = format.replace("{plainsender}", sender.getName());
format = format.replace("{world}", sender.getWorld().getName());
Chat chat = Herochat.getChatService();
if (chat != null)
{
try
{
String prefix = chat.getPlayerPrefix(sender);
if (prefix == null || prefix == "")
{
prefix = chat.getPlayerPrefix((String)null, sender.getName());
}
String suffix = chat.getPlayerSuffix(sender);
if (suffix == null || suffix == "")
{
suffix = chat.getPlayerSuffix((String)null, sender.getName());
}
String group = chat.getPrimaryGroup(sender);
String groupPrefix = group == null ? "" : chat.getGroupPrefix(sender.getWorld(), group);
if (group != null && (groupPrefix == null || groupPrefix == ""))
{
groupPrefix = chat.getGroupPrefix((String)null, group);
}
String groupSuffix = group == null ? "" : chat.getGroupSuffix(sender.getWorld(), group);
if (group != null && (groupSuffix == null || groupSuffix == ""))
{
groupSuffix = chat.getGroupSuffix((String)null, group);
}
format = format.replace("{prefix}", prefix == null ? "" : prefix.replace("%", "%%"));
format = format.replace("{suffix}", suffix == null ? "" : suffix.replace("%", "%%"));
format = format.replace("{group}", group == null ? "" : group.replace("%", "%%"));
format = format.replace("{groupprefix}", groupPrefix == null ? "" : groupPrefix.replace("%", "%%"));