From 8480324ab7b2bb11704b2ba08d0c4e452caf52d2 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Tue, 10 May 2022 16:54:24 -0400 Subject: [PATCH] rank-place palceholder change --- .../net/tylermurphy/hideAndSeek/database/PlayerInfoTable.java | 2 +- .../java/net/tylermurphy/hideAndSeek/util/PAPIExpansion.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfoTable.java b/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfoTable.java index b4f1602..35912fe 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfoTable.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/database/PlayerInfoTable.java @@ -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(); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/PAPIExpansion.java b/src/main/java/net/tylermurphy/hideAndSeek/util/PAPIExpansion.java index d467b62..e7bca4a 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/PAPIExpansion.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/util/PAPIExpansion.java @@ -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();