mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-28 21:56:37 +01:00
57 lines
1.9 KiB
Diff
57 lines
1.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Ivan Pekov <ivan@mrivanplays.com>
|
|
Date: Sun, 27 Sep 2020 18:01:50 +0300
|
|
Subject: [PATCH] Add last tick time API
|
|
|
|
Original patch by:
|
|
Co-authored-by: tr7zw <tr7zw@live.de>
|
|
|
|
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
|
index e8414592b3afeb1e5db2b817b8fb7c13e073b9aa..a456aa138d148b0d1b5c8b2330422bf66bec59fe 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -1963,4 +1963,14 @@ public final class Bukkit {
|
|
public static Server.Spigot spigot() {
|
|
return server.spigot();
|
|
}
|
|
+
|
|
+ // 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 c8777df1cba3be24d52454954992f4d4dfcdc681..cc46fbb96e25f706b5d7c068576cf99ba693b448 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -1740,4 +1740,24 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
|
@NotNull
|
|
io.papermc.paper.datapack.DatapackManager getDatapackManager();
|
|
// Paper 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
|
|
}
|