diff --git a/src/main/java/jp/azisaba/lgw/rankingdisplayer/integration/KDSPlaceholderExpansion.java b/src/main/java/jp/azisaba/lgw/rankingdisplayer/integration/KDSPlaceholderExpansion.java index 3ff7517..c147b04 100644 --- a/src/main/java/jp/azisaba/lgw/rankingdisplayer/integration/KDSPlaceholderExpansion.java +++ b/src/main/java/jp/azisaba/lgw/rankingdisplayer/integration/KDSPlaceholderExpansion.java @@ -1,5 +1,6 @@ package jp.azisaba.lgw.rankingdisplayer.integration; +import jp.azisaba.lgw.rankingdisplayer.ranking.RankingType; import me.clip.placeholderapi.expansion.PlaceholderExpansion; import org.bukkit.OfflinePlayer; import org.jetbrains.annotations.NotNull; @@ -34,12 +35,16 @@ public boolean persist() { public @Nullable String onRequest(OfflinePlayer player, @NotNull String params) { if(params.startsWith(getIdentifier() + "_")) { String name = params.split(getIdentifier() + "_")[1]; - if(name.equalsIgnoreCase(Names.PLAYER_RANKING)) { - // TODO get player ranking - return "ranking"; - } else if (name.equalsIgnoreCase(Names.PLAYER_KILL_COUNT)) { - // TODO get player's kill count - return "kill_count"; + if(name.startsWith(Names.PLAYER_RANKING)) { + name = name.split(Names.PLAYER_RANKING + "_")[1]; + RankingType type = RankingType.getType(name); + if(type==null) return null; + return String.valueOf(KDSAPI.getPlayerRanking(player.getUniqueId(), type.getKdStatusTimeUnit())); + } else if (name.startsWith(Names.PLAYER_KILL_COUNT)) { + name = name.split(Names.PLAYER_KILL_COUNT + "_")[1]; + RankingType type = RankingType.getType(name); + if(type==null) return null; + return String.valueOf(KDSAPI.getPlayerKills(player.getPlayer(), type.getKdStatusTimeUnit())); } } return null;