mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-02 08:39:49 +01:00
Merge pull request #515 from t00thpick1/patch-2
Fix mcRank command for SQL
This commit is contained in:
commit
e0da44b34a
@ -425,19 +425,19 @@ public class Database {
|
||||
if (checkConnected()) {
|
||||
try {
|
||||
String sql = "SELECT "
|
||||
+ "(SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.taming+s.mining+s.woodcutting+s.repair+s.unarmed+s.herbalism+s.excavation+s.archery+s.swords+s.axes+s.acrobatics+s.fishing >= (SELECT s.taming+s.mining+s.woodcutting+s.repair+s.unarmed+s.herbalism+s.excavation+s.archery+s.swords+s.axes+s.acrobatics+s.fishing FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = " + playerName + ")) AS 'ALL'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.fishing >= (SELECT s.fishing FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = " + playerName + ")) AS 'FISHING'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.taming >= (SELECT s.taming FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = " + playerName + ")) AS 'TAMING'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.woodcutting >= (SELECT s.woodcutting FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = " + playerName + ")) AS 'WOODCUTTING'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.repair >= (SELECT s.repair FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = " + playerName + ")) AS 'REPAIR'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.unarmed >= (SELECT s.unarmed FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = " + playerName + ")) AS 'UNARMED'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.herbalism >= (SELECT s.herbalism FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = " + playerName + ")) AS 'HERBALISM'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.excavation >= (SELECT s.excavation FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = " + playerName + ")) AS 'EXCAVATION'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.archery >= (SELECT s.archery FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = " + playerName + ")) AS 'ARCHERY'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.swords >= (SELECT s.swords FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = " + playerName + ")) AS 'SWORDS'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.axes >= (SELECT s.axes FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = " + playerName + ")) AS 'AXES'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.acrobatics >= (SELECT s.acrobatics FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = " + playerName + ")) AS 'ACROBATICS'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.mining >= (SELECT s.mining FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = " + playerName + ")) AS 'MINING'";
|
||||
+ "(SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.taming+s.mining+s.woodcutting+s.repair+s.unarmed+s.herbalism+s.excavation+s.archery+s.swords+s.axes+s.acrobatics+s.fishing >= (SELECT s.taming+s.mining+s.woodcutting+s.repair+s.unarmed+s.herbalism+s.excavation+s.archery+s.swords+s.axes+s.acrobatics+s.fishing FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = '" + playerName + "')) AS 'ALL'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.fishing >= (SELECT s.fishing FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = '" + playerName + "')) AS 'FISHING'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.taming >= (SELECT s.taming FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = '" + playerName + "')) AS 'TAMING'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.woodcutting >= (SELECT s.woodcutting FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = '" + playerName + "')) AS 'WOODCUTTING'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.repair >= (SELECT s.repair FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = '" + playerName + "')) AS 'REPAIR'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.unarmed >= (SELECT s.unarmed FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = '" + playerName + "')) AS 'UNARMED'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.herbalism >= (SELECT s.herbalism FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = '" + playerName + "')) AS 'HERBALISM'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.excavation >= (SELECT s.excavation FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = '" + playerName + "')) AS 'EXCAVATION'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.archery >= (SELECT s.archery FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = '" + playerName + "')) AS 'ARCHERY'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.swords >= (SELECT s.swords FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = '" + playerName + "')) AS 'SWORDS'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.axes >= (SELECT s.axes FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = '" + playerName + "')) AS 'AXES'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.acrobatics >= (SELECT s.acrobatics FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = '" + playerName + "')) AS 'ACROBATICS'"
|
||||
+ ", (SELECT (COUNT(*)+1) AS rank FROM " + tablePrefix + "skills AS s, " + tablePrefix + "users AS u WHERE u.id = s.user_id AND s.mining >= (SELECT s.mining FROM " + tablePrefix + "skills as s, " + tablePrefix + "users as u WHERE u.id = s.user_id AND u.user = '" + playerName + "')) AS 'MINING'";
|
||||
PreparedStatement statement = connection.prepareStatement(sql);
|
||||
resultSet = statement.executeQuery();
|
||||
while (resultSet.next()) {
|
||||
|
Loading…
Reference in New Issue
Block a user