mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
Comments so I don't forget why I did it like this again
This commit is contained in:
parent
9b24dd306c
commit
7e92905618
@ -375,6 +375,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
connection = getConnection(PoolIdentifier.MISC);
|
connection = getConnection(PoolIdentifier.MISC);
|
||||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
||||||
String skillName = skillType.name().toLowerCase();
|
String skillName = skillType.name().toLowerCase();
|
||||||
|
// Get count of all users with higher skill level than player
|
||||||
String sql = "SELECT COUNT(*) AS rank FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillName + " > 0 " +
|
String sql = "SELECT COUNT(*) AS rank FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillName + " > 0 " +
|
||||||
"AND " + skillName + " > (SELECT " + skillName + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id " +
|
"AND " + skillName + " > (SELECT " + skillName + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id " +
|
||||||
"WHERE user = ?)";
|
"WHERE user = ?)";
|
||||||
@ -387,6 +388,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
int rank = resultSet.getInt("rank");
|
int rank = resultSet.getInt("rank");
|
||||||
|
|
||||||
|
// Ties are settled by alphabetical order
|
||||||
sql = "SELECT user, " + skillName + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillName + " > 0 " +
|
sql = "SELECT user, " + skillName + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillName + " > 0 " +
|
||||||
"AND " + skillName + " = (SELECT " + skillName + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id " +
|
"AND " + skillName + " = (SELECT " + skillName + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id " +
|
||||||
"WHERE user = '" + playerName + "') ORDER BY user";
|
"WHERE user = '" + playerName + "') ORDER BY user";
|
||||||
|
Loading…
Reference in New Issue
Block a user