diff --git a/Plan/bukkit/src/main/java/com/djrapitops/plan/addons/placeholderapi/placeholders/PlayerPlaceHolder.java b/Plan/bukkit/src/main/java/com/djrapitops/plan/addons/placeholderapi/placeholders/PlayerPlaceHolder.java index e0d7d7a89..e3c24523d 100644 --- a/Plan/bukkit/src/main/java/com/djrapitops/plan/addons/placeholderapi/placeholders/PlayerPlaceHolder.java +++ b/Plan/bukkit/src/main/java/com/djrapitops/plan/addons/placeholderapi/placeholders/PlayerPlaceHolder.java @@ -45,6 +45,7 @@ import java.util.UUID; public class PlayerPlaceHolder extends AbstractPlanPlaceHolder { private final DBSystem dbSystem; + private final Formatter decimals; private Formatter year; private Formatter time; @@ -57,10 +58,11 @@ public class PlayerPlaceHolder extends AbstractPlanPlaceHolder { this.dbSystem = dbSystem; time = formatters.timeAmount(); year = formatters.yearLong(); + decimals = formatters.decimals(); } @Override - public String onPlaceholderRequest(Player p, String params) throws Exception { + public String onPlaceholderRequest(Player p, String params) { Serializable got = get(params, p.getUniqueId()); return got != null ? got.toString() : null; } @@ -93,12 +95,17 @@ public class PlayerPlaceHolder extends AbstractPlanPlaceHolder { return PlayerVersusMutator.forContainer(player).toKillDeathRatio(); case "player_ping_average_day": - return PingMutator.forContainer(player).filterBy(Predicates.within(dayAgo(), now())).average(); + return decimals.apply(PingMutator.forContainer(player) + .filterBy(Predicates.within(dayAgo(), now())) + .average()) + " ms"; case "player_ping_average_week": - return PingMutator.forContainer(player).filterBy(Predicates.within(weekAgo(), now())).average(); - + return decimals.apply(PingMutator.forContainer(player) + .filterBy(Predicates.within(weekAgo(), now())) + .average()) + " ms"; case "player_ping_average_month": - return PingMutator.forContainer(player).filterBy(Predicates.within(monthAgo(), now())).average(); + return decimals.apply(PingMutator.forContainer(player) + .filterBy(Predicates.within(monthAgo(), now())) + .average()) + " ms"; case "player_lastseen": return year.apply(player.getValue(PlayerKeys.LAST_SEEN).orElse((long) 0)); diff --git a/Plan/bukkit/src/main/java/com/djrapitops/plan/addons/placeholderapi/placeholders/ServerPlaceHolders.java b/Plan/bukkit/src/main/java/com/djrapitops/plan/addons/placeholderapi/placeholders/ServerPlaceHolders.java index e93f7e620..e3b203d80 100644 --- a/Plan/bukkit/src/main/java/com/djrapitops/plan/addons/placeholderapi/placeholders/ServerPlaceHolders.java +++ b/Plan/bukkit/src/main/java/com/djrapitops/plan/addons/placeholderapi/placeholders/ServerPlaceHolders.java @@ -50,7 +50,7 @@ public class ServerPlaceHolders extends AbstractPlanPlaceHolder { } @Override - public String onPlaceholderRequest(Player p, String params) throws Exception { + public String onPlaceholderRequest(Player p, String params) { Database database = dbSystem.getDatabase(); UUID serverUUID = serverUUID(); Serializable got = get(params, database, serverUUID); diff --git a/Plan/bukkit/src/main/java/com/djrapitops/plan/addons/placeholderapi/placeholders/SessionPlaceHolder.java b/Plan/bukkit/src/main/java/com/djrapitops/plan/addons/placeholderapi/placeholders/SessionPlaceHolder.java index a6a196452..f62107708 100644 --- a/Plan/bukkit/src/main/java/com/djrapitops/plan/addons/placeholderapi/placeholders/SessionPlaceHolder.java +++ b/Plan/bukkit/src/main/java/com/djrapitops/plan/addons/placeholderapi/placeholders/SessionPlaceHolder.java @@ -42,6 +42,7 @@ import java.util.UUID; public class SessionPlaceHolder extends AbstractPlanPlaceHolder { private final DBSystem dbSystem; + private final Formatter decimals; private Formatter timeAmount; private int tzOffsetMs; private Formatter year; @@ -58,10 +59,11 @@ public class SessionPlaceHolder extends AbstractPlanPlaceHolder { tzOffsetMs = config.getTimeZone().getOffset(System.currentTimeMillis()); timeAmount = formatters.timeAmount(); year = formatters.year(); + decimals = formatters.decimals(); } @Override - public String onPlaceholderRequest(Player p, String params) throws Exception { + public String onPlaceholderRequest(Player p, String params) { Serializable got = get(params); return got != null ? got.toString() : null; } @@ -163,13 +165,13 @@ public class SessionPlaceHolder extends AbstractPlanPlaceHolder { return database.query(PlayerCountQueries.newPlayerCount(monthAgo(), now(), serverUUID)); case "ping_total": - return database.query(PingQueries.averagePing(0L, now(), serverUUID)); + return decimals.apply(database.query(PingQueries.averagePing(0L, now(), serverUUID))) + " ms"; case "ping_day": - return database.query(PingQueries.averagePing(dayAgo(), now(), serverUUID)); + return decimals.apply(database.query(PingQueries.averagePing(dayAgo(), now(), serverUUID))) + " ms"; case "ping_week": - return database.query(PingQueries.averagePing(weekAgo(), now(), serverUUID)); + return decimals.apply(database.query(PingQueries.averagePing(weekAgo(), now(), serverUUID))) + " ms"; case "ping_month": - return database.query(PingQueries.averagePing(monthAgo(), now(), serverUUID)); + return decimals.apply(database.query(PingQueries.averagePing(monthAgo(), now(), serverUUID))) + " ms"; case "sessions_peak_count": return database.query(TPSQueries.fetchAllTimePeakPlayerCount(serverUUID)).map(DateObj::getValue).orElse(0);