public static String getLevelForChat(UUID mojangId) { Integer maxScore = MiscUtil.getMaxScore(mojangId); if (maxScore == null) return ""; double scoreRange = maxScore / 5.0; int chatScore = (int) ((MiscUtil.getScore(mojangId) != 0 ? MiscUtil.getScore(mojangId) : 1) / scoreRange); if (chatScore < 1) chatScore = 1; if (chatScore > 5) chatScore = 5; return CHAT_SCORES.get(chatScore); }
public static String getLevelForChat(String playerName) { UUID id = MiscUtil.getId(playerName); if (id != null) return getLevelForChat(id); return ""; }