Fix ELO query

This commit is contained in:
TadahTech 2016-04-28 21:20:48 -05:00
parent 84ca13c0d3
commit 00efb7d72e
2 changed files with 3 additions and 3 deletions

View File

@ -29,7 +29,6 @@ public class EloRepository extends MinecraftRepository
private static String GRAB_BAN_EXPIRY = "SELECT banEnd FROM rankedBans WHERE accountId = ?;";
private static String UPDATE_BAN = "INSERT INTO rankedBans (accountId, strikes, strikesExpire, banEnd) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE strikes=VALUES(strikes), strikesExpire=VALUES(strikesExpire), banEnd=VALUES(banEnd);";
private static String DELETE_STRIKES = "UPDATE rankedBans SET strikes = 1 WHERE accountId = ?;";
private static String GET_ELO = "SELECT `elo`,`accountId` FROM `eloRating` ORDER BY `elo` DESC LIMIT $limit;";
private static String GET_NAME_FROM_ID = "SELECT `name` FROM `accounts` WHERE `id`=?;";
public EloRepository(JavaPlugin plugin)
@ -203,7 +202,8 @@ public class EloRepository extends MinecraftRepository
List<TopEloData> dataList = Lists.newArrayList();
try
{
statement = connection.prepareStatement(GET_ELO.replace("$limit", String.valueOf(limit)));
String GET_ELO = "SELECT `elo`,`accountId` FROM `eloRating` WHERE `gameType`=? ORDER BY `elo` DESC LIMIT " + limit + ";" ;
statement = connection.prepareStatement(GET_ELO);
statement.setInt(1, gameId);
ResultSet resultSet = statement.executeQuery();
while (resultSet.next())

View File

@ -33,7 +33,7 @@ public class TopEloCommand extends CommandBase<EloManager>
return;
}
String limitRaw = args[0];
int limit = 10;
int limit;
try
{
limit = Integer.parseInt(limitRaw);