Skip to content

Commit

Permalink
[Add] KDSPlaceholderExpansion support placeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
sysnote8main committed Oct 6, 2024
1 parent 2beed49 commit 093e332
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 093e332

Please sign in to comment.