rank-place palceholder change
This commit is contained in:
parent
487ce5e3f5
commit
8480324ab7
2 changed files with 5 additions and 1 deletions
|
@ -188,7 +188,7 @@ public class PlayerInfoTable {
|
|||
|
||||
@Nullable
|
||||
public Integer getRanking(String order, UUID uuid){
|
||||
String sql = "SELECT count(*) AS total FROM hs_data WHERE "+order+" < (SELECT "+order+" FROM hs_data WHERE uuid = ?);";
|
||||
String sql = "SELECT count(*) AS total FROM hs_data WHERE "+order+" >= (SELECT "+order+" FROM hs_data WHERE uuid = ?) AND hider_wins > 0;";
|
||||
try(Connection connection = Database.connect(); PreparedStatement statement = connection.prepareStatement(sql)){
|
||||
statement.setBytes(1, encodeUUID(uuid));
|
||||
ResultSet rs = statement.executeQuery();
|
||||
|
|
|
@ -59,6 +59,8 @@ public class PAPIExpansion extends PlaceholderExpansion {
|
|||
}
|
||||
} else if(args[0].equals("rank-place") && args.length == 2){
|
||||
if(getRanking(args[1]) == null) { return placeholderError; }
|
||||
PlayerInfo info = Database.playerInfo.getInfo(player.getUniqueId());
|
||||
if(getValue(info, args[1]).equals("0")) { return "-"; }
|
||||
Integer count = Database.playerInfo.getRanking(getRanking(args[1]), player.getUniqueId());
|
||||
if(count == null) { return placeholderNoData; }
|
||||
return count.toString();
|
||||
|
@ -66,6 +68,8 @@ public class PAPIExpansion extends PlaceholderExpansion {
|
|||
UUID uuid;
|
||||
try { uuid = UUIDFetcher.getUUID(args[2]); } catch (Exception e) { return placeholderError; }
|
||||
if(getRanking(args[1]) == null) { return placeholderError; }
|
||||
PlayerInfo info = Database.playerInfo.getInfo(player.getUniqueId());
|
||||
if(getValue(info, args[1]).equals("0")) { return "-"; }
|
||||
Integer count = Database.playerInfo.getRanking(getRanking(args[1]), uuid);
|
||||
if(count == null) { return placeholderNoData; }
|
||||
return count.toString();
|
||||
|
|
Loading…
Reference in a new issue