Fix ELO query
This commit is contained in:
parent
84ca13c0d3
commit
00efb7d72e
@ -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())
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user