mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-05 03:53:41 +00:00
Drop messageFormat for simple string replace, remove duped ' marks.
This commit is contained in:
parent
3e519f95d5
commit
0292cb59cd
3 changed files with 18 additions and 21 deletions
|
@ -402,26 +402,23 @@ public class Settings implements ISettings
|
|||
{
|
||||
return config.getString("backup.command", null);
|
||||
}
|
||||
private Map<String, MessageFormat> chatFormats = Collections.synchronizedMap(new HashMap<String, MessageFormat>());
|
||||
private Map<String, String> chatFormats = Collections.synchronizedMap(new HashMap<String, String>());
|
||||
|
||||
@Override
|
||||
public MessageFormat getChatFormat(String group)
|
||||
public String getChatFormat(String group)
|
||||
{
|
||||
MessageFormat mFormat = chatFormats.get(group);
|
||||
String mFormat = chatFormats.get(group);
|
||||
if (mFormat == null)
|
||||
{
|
||||
String format = config.getString("chat.group-formats." + (group == null ? "Default" : group),
|
||||
mFormat = config.getString("chat.group-formats." + (group == null ? "Default" : group),
|
||||
config.getString("chat.format", "&7[{GROUP}]&r {DISPLAYNAME}&7:&r {MESSAGE}"));
|
||||
format = FormatUtil.replaceFormat(format);
|
||||
format = format.replace("'", "''");
|
||||
format = format.replace("{DISPLAYNAME}", "%1$s");
|
||||
format = format.replace("{GROUP}", "{0}");
|
||||
format = format.replace("{MESSAGE}", "%2$s");
|
||||
format = format.replace("{WORLDNAME}", "{1}");
|
||||
format = format.replace("{SHORTWORLDNAME}", "{2}");
|
||||
format = format.replaceAll("\\{(\\D*?)\\}", "'\\{$1\\}'");
|
||||
format = "§r".concat(format);
|
||||
mFormat = new MessageFormat(format);
|
||||
mFormat = FormatUtil.replaceFormat(mFormat);
|
||||
mFormat = mFormat.replace("{DISPLAYNAME}", "%1$s");
|
||||
mFormat = mFormat.replace("{MESSAGE}", "%2$s");
|
||||
mFormat = mFormat.replace("{GROUP}", "{0}");
|
||||
mFormat = mFormat.replace("{WORLDNAME}", "{1}");
|
||||
mFormat = mFormat.replace("{SHORTWORLDNAME}", "{2}");
|
||||
mFormat = "§r".concat(mFormat);
|
||||
chatFormats.put(group, mFormat);
|
||||
}
|
||||
return mFormat;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue