From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Ivan Pekov Date: Sun, 27 Sep 2020 18:01:50 +0300 Subject: [PATCH] Add last tick time API Original patch by: Co-authored-by: tr7zw diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java index 194261bf20bb727d207a2429fa59abf0acf61b19..15203139858b09a5ba75545c0c19c89d48419a2c 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -1983,4 +1983,14 @@ public final class Bukkit { return server.isLagging(); } // Purpur end + + // Yatopia start + @Deprecated + public static long getLastTickMs() { + return server.getLastTickMs(); + } + @NotNull public static java.time.Duration getLastTickTime() { + return server.getLastTickTime(); + } + // Yatopia end } diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java index d756eb5ff47611a3edf616387c252e8c75207a21..8bebea38ce408afd7a0c7590625d63535fdb0960 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -1771,4 +1771,24 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi */ boolean isLagging(); // Purpur end + + // Yatopia start + /** + * Returns the time the last tick took in milliseconds. + * + * @return long time value + * @deprecated newer method with java's Duration and a possibility to convert it from millis to something else + */ + @Deprecated + default long getLastTickMs() { + return getLastTickTime().toMillis(); + } + /** + * Returns the time in {@link java.time.Duration} the last tick took. + * + * @return duration + */ + @NotNull + java.time.Duration getLastTickTime(); + // Yatopia end }