Exemple #1
0
  public String getNick(final boolean longnick) {
    final StringBuilder prefix = new StringBuilder();
    String nickname;
    String suffix = "";
    final String nick = getNickname();
    if (ess.getSettings().isCommandDisabled("nick")
        || nick == null
        || nick.isEmpty()
        || nick.equals(getName())) {
      nickname = getName();
    } else if (nick.equalsIgnoreCase(getName())) {
      nickname = nick;
    } else {
      nickname = ess.getSettings().getNicknamePrefix() + nick;
      suffix = "§r";
    }

    if (this.getBase().isOp()) {
      try {
        final ChatColor opPrefix = ess.getSettings().getOperatorColor();
        if (opPrefix != null && opPrefix.toString().length() > 0) {
          prefix.insert(0, opPrefix.toString());
          suffix = "§r";
        }
      } catch (Exception e) {
      }
    }

    if (ess.getSettings().addPrefixSuffix()) {
      // These two extra toggles are not documented, because they are mostly redundant #EasterEgg
      if (!ess.getSettings().disablePrefix()) {
        final String ptext = ess.getPermissionsHandler().getPrefix(base).replace('&', '§');
        prefix.insert(0, ptext);
        suffix = "§r";
      }
      if (!ess.getSettings().disableSuffix()) {
        final String stext = ess.getPermissionsHandler().getSuffix(base).replace('&', '§');
        suffix = stext + "§r";
        suffix = suffix.replace("§f§f", "§f").replace("§f§r", "§r").replace("§r§r", "§r");
      }
    }
    final String strPrefix = prefix.toString();
    String output = strPrefix + nickname + suffix;
    if (!longnick && output.length() > 16) {
      output = strPrefix + nickname;
    }
    if (!longnick && output.length() > 16) {
      output = FormatUtil.lastCode(strPrefix) + nickname;
    }
    if (!longnick && output.length() > 16) {
      output = FormatUtil.lastCode(strPrefix) + nickname.substring(0, 14);
    }
    if (output.charAt(output.length() - 1) == '§') {
      output = output.substring(0, output.length() - 1);
    }
    return output;
  }
Exemple #2
0
 @Override
 public int compareTo(final User other) {
   return FormatUtil.stripFormat(getDisplayName())
       .compareToIgnoreCase(FormatUtil.stripFormat(other.getDisplayName()));
 }