From acbfd7824d14b8ac62c1d97568093b7f797ed0f3 Mon Sep 17 00:00:00 2001 From: mallusrgreat Date: Tue, 20 Jan 2026 21:35:39 +0530 Subject: [PATCH] Add kills & deaths placeholders --- .../placeholder/PlaceholderManager.java | 5 +++++ .../placeholder/impl/DeathsPlaceholder.java | 22 +++++++++++++++++++ .../placeholder/impl/KillsPlaceholder.java | 22 +++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 Plugin/src/main/java/dev/lrxh/neptune/providers/placeholder/impl/DeathsPlaceholder.java create mode 100644 Plugin/src/main/java/dev/lrxh/neptune/providers/placeholder/impl/KillsPlaceholder.java diff --git a/Plugin/src/main/java/dev/lrxh/neptune/providers/placeholder/PlaceholderManager.java b/Plugin/src/main/java/dev/lrxh/neptune/providers/placeholder/PlaceholderManager.java index a83a8c56..1e064671 100644 --- a/Plugin/src/main/java/dev/lrxh/neptune/providers/placeholder/PlaceholderManager.java +++ b/Plugin/src/main/java/dev/lrxh/neptune/providers/placeholder/PlaceholderManager.java @@ -19,6 +19,9 @@ public PlaceholderManager() { new InMatchPlaceholder(), new QueuedPlaceholder(), new WinsPlaceholder(), + new LossesPlaceholder(), + new KillsPlaceholder(), + new DeathsPlaceholder(), new MaxPingPlaceholder(), new CurrentStreakPlaceholder(), new BestStreakPlaceholder(), @@ -27,6 +30,8 @@ public PlaceholderManager() { new KitDivisionPlaceholder(), new KitWinsPlaceholder(), new KitLossesPlaceholder(), + new KitKillsPlaceholder(), + new KitDeathsPlaceholder(), new KitCurrentStreakPlaceholder(), new KitBestStreakPlaceholder(), new LeaderboardPlaceholder(), diff --git a/Plugin/src/main/java/dev/lrxh/neptune/providers/placeholder/impl/DeathsPlaceholder.java b/Plugin/src/main/java/dev/lrxh/neptune/providers/placeholder/impl/DeathsPlaceholder.java new file mode 100644 index 00000000..06f7a3ff --- /dev/null +++ b/Plugin/src/main/java/dev/lrxh/neptune/providers/placeholder/impl/DeathsPlaceholder.java @@ -0,0 +1,22 @@ +package dev.lrxh.neptune.providers.placeholder.impl; + +import dev.lrxh.neptune.API; +import dev.lrxh.neptune.profile.data.GlobalStats; +import dev.lrxh.neptune.profile.impl.Profile; +import dev.lrxh.neptune.providers.placeholder.Placeholder; +import org.bukkit.OfflinePlayer; + +public class DeathsPlaceholder implements Placeholder { + @Override + public boolean match(String string) { + return string.equals("deaths"); + } + + @Override + public String parse(OfflinePlayer player, String string) { + Profile profile = API.getProfile(player.getUniqueId()); + if (profile == null) return string; + GlobalStats globalStats = profile.getGameData().getGlobalStats(); + return String.valueOf(globalStats.getDeaths()); + } +} diff --git a/Plugin/src/main/java/dev/lrxh/neptune/providers/placeholder/impl/KillsPlaceholder.java b/Plugin/src/main/java/dev/lrxh/neptune/providers/placeholder/impl/KillsPlaceholder.java new file mode 100644 index 00000000..f2cf1eca --- /dev/null +++ b/Plugin/src/main/java/dev/lrxh/neptune/providers/placeholder/impl/KillsPlaceholder.java @@ -0,0 +1,22 @@ +package dev.lrxh.neptune.providers.placeholder.impl; + +import dev.lrxh.neptune.API; +import dev.lrxh.neptune.profile.data.GlobalStats; +import dev.lrxh.neptune.profile.impl.Profile; +import dev.lrxh.neptune.providers.placeholder.Placeholder; +import org.bukkit.OfflinePlayer; + +public class KillsPlaceholder implements Placeholder { + @Override + public boolean match(String string) { + return string.equals("kills"); + } + + @Override + public String parse(OfflinePlayer player, String string) { + Profile profile = API.getProfile(player.getUniqueId()); + if (profile == null) return string; + GlobalStats globalStats = profile.getGameData().getGlobalStats(); + return String.valueOf(globalStats.getKills()); + } +}