2020-09-27 18:05:16 +02:00
|
|
|
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
|
|
|
|
|
2020-09-27 19:43:40 +02:00
|
|
|
Original patch by:
|
|
|
|
Co-authored-by: tr7zw <tr7zw@live.de>
|
2020-09-27 18:05:16 +02:00
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
2020-11-07 08:02:33 +01:00
|
|
|
index a1c7fdcf34519c4781fcd8190d7c2ee787448694..63419981b73173c3f0bf798f265934488a69973c 100644
|
2020-09-27 18:05:16 +02:00
|
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
2020-11-07 08:02:33 +01:00
|
|
|
@@ -1819,4 +1819,14 @@ public final class Bukkit {
|
2020-09-27 18:05:16 +02:00
|
|
|
return server.isLagging();
|
|
|
|
}
|
|
|
|
// Purpur end
|
|
|
|
+
|
|
|
|
+ // Yatopia start
|
|
|
|
+ @Deprecated
|
|
|
|
+ public static long getLastTickMs() {
|
|
|
|
+ return server.getLastTickMs();
|
|
|
|
+ }
|
|
|
|
+ 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
|
2020-11-07 08:02:33 +01:00
|
|
|
index 720b39459382511cf23ee8af431f0fc4a691358c..0dadd5a215c9308e9833db75003361d47bd0c91b 100644
|
2020-09-27 18:05:16 +02:00
|
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
2020-11-07 08:02:33 +01:00
|
|
|
@@ -1644,4 +1644,23 @@ public interface Server extends PluginMessageRecipient {
|
2020-09-27 18:05:16 +02:00
|
|
|
*/
|
|
|
|
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
|
|
|
|
+ */
|
|
|
|
+ java.time.Duration getLastTickTime();
|
|
|
|
+ // Yatopia end
|
|
|
|
}
|