public static String getLogMessage(MapleClient cfor, String message, Object...parms) {
StringBuilder builder = new StringBuilder();
if (cfor != null) {
if (cfor.getPlayer() != null) {
builder.append("<");
builder.append(MapleCharacterUtil.makeMapleReadable(cfor.getPlayer().getName()));
builder.append(" (cid: ");
builder.append(cfor.getPlayer().getId());
builder.append(")> ");
}
if (cfor.getAccountName() != null) {
builder.append("(Account: ");
builder.append(MapleCharacterUtil.makeMapleReadable(cfor.getAccountName()));
builder.append(") ");
}
}
builder.append(message);
for (Object parm: parms) {
int start = builder.indexOf("{}");
builder.replace(start, start + 2, parm.toString());
}
return builder.toString();
}