Untitled

mail@pastecode.io avatar
unknown
java
a year ago
874 B
2
Indexable
Never
  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();
  }