mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
More changes
This commit is contained in:
parent
c073c7ed3a
commit
c0dfcfd9f6
@ -31,9 +31,9 @@ public class mcRankAsync implements Runnable {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
if (skillType.equals(SkillType.ALL))
|
||||
continue; // We want the overall ranking to be at the bottom
|
||||
sender.sendMessage(ChatColor.YELLOW + Misc.getCapitalized(skillType.name()) + ChatColor.GREEN + " - " + ChatColor.GOLD + "Rank " + ChatColor.WHITE + "#" + ChatColor.GREEN + skills.get(skillType.name()));
|
||||
sender.sendMessage(ChatColor.YELLOW + Misc.getCapitalized(skillType.name()) + ChatColor.GREEN + " - " + (skills.get(skillType.name()) == null ? ChatColor.WHITE + "Unranked" : ChatColor.GOLD + "Rank " + ChatColor.WHITE + "#" + ChatColor.GREEN + skills.get(skillType.name())));
|
||||
}
|
||||
sender.sendMessage(ChatColor.YELLOW + "Overall" + ChatColor.GREEN + " - " + ChatColor.GOLD + "Rank " + ChatColor.WHITE + "#" + ChatColor.GREEN + skills.get("ALL"));
|
||||
sender.sendMessage(ChatColor.YELLOW + "Overall" + ChatColor.GREEN + " - " + (skills.get("ALL") == null ? ChatColor.WHITE + "Unranked" : ChatColor.GOLD + "Rank " + ChatColor.WHITE + "#" + ChatColor.GREEN + skills.get("ALL")));
|
||||
}
|
||||
|
||||
|
||||
|
@ -461,15 +461,18 @@ public class Database {
|
||||
for (SkillType skillType: SkillType.values()) {
|
||||
String sql;
|
||||
if(skillType != SkillType.ALL) {
|
||||
sql = "SELECT rank AS '" + skillType.name() + "' FROM (SELECT @rownum:=@rownum+1 rank, user, NOW() FROM (SELECT @rownum:=0) AS r, ((SELECT user FROM " + tablePrefix + "users, " + tablePrefix + "skills WHERE id = user_id ORDER BY " + skillType.name().toLowerCase() + " desc) AS p)) AS d WHERE user = '" + playerName + "'";
|
||||
sql = "SELECT user, " + skillType.name().toLowerCase() + " FROM " + tablePrefix + "users, " + tablePrefix + "skills WHERE id = user_id AND " + skillType.name().toLowerCase() + " > 0 AND " + skillType.name().toLowerCase() + " >= (SELECT " + skillType.name().toLowerCase() + " FROM " + tablePrefix + "skills, " + tablePrefix + "users WHERE user = '" + playerName + "' AND id = user_id) ORDER BY " + skillType.name().toLowerCase() + " desc";
|
||||
} else {
|
||||
sql = "SELECT rank AS 'ALL' FROM (SELECT @rownum:=@rownum+1 rank, user, NOW() FROM (SELECT @rownum:=0) AS r, ((SELECT user FROM " + tablePrefix + "users, " + tablePrefix + "skills WHERE id = user_id ORDER BY taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing desc) AS p)) AS d WHERE user = '" + playerName + "'";
|
||||
sql = "SELECT user, taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing FROM " + tablePrefix + "users, " + tablePrefix + "skills WHERE id = user_id AND taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing >= (SELECT taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing FROM " + tablePrefix + "skills, " + tablePrefix + "users WHERE user = '" + playerName + "' AND id = user_id) ORDER BY taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing desc";
|
||||
}
|
||||
|
||||
PreparedStatement statement = connection.prepareStatement(sql);
|
||||
resultSet = statement.executeQuery();
|
||||
while (resultSet.next()) {
|
||||
skills.put(skillType.name(), resultSet.getInt(skillType.name()));
|
||||
if(resultSet.getString("user").equalsIgnoreCase(playerName)) {
|
||||
skills.put(skillType.name(), resultSet.getRow());
|
||||
break;
|
||||
}
|
||||
}
|
||||
statement.close();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user