mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-20 15:29:15 +00:00
61 lines
2.1 KiB
Diff
61 lines
2.1 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 code by YatopiaMC, licensed under MIT
|
|
You can find the original code on https://github.com/YatopiaMC/Yatopia
|
|
|
|
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
|
index 232c08c9a588d957d90f198ce479e57615c6e650..bfa71be59dd84459bd420ace2d6694e1d80aee81 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -2430,6 +2430,16 @@ public final class Bukkit {
|
|
return server.isStopping();
|
|
}
|
|
|
|
+ // Yatopia start
|
|
+ @Deprecated
|
|
+ public static long getLastTickMs() {
|
|
+ return server.getLastTickMs();
|
|
+ }
|
|
+ @NotNull public static java.time.Duration getLastTickTime() {
|
|
+ return server.getLastTickTime();
|
|
+ }
|
|
+ // Yatopia end
|
|
+
|
|
/**
|
|
* Returns the {@link com.destroystokyo.paper.entity.ai.MobGoals} manager
|
|
*
|
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
|
index e43fef0152468944d8a33036344a43e95fe58476..6f4250d7750c7d834db87be14d82caaa4d94b51c 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -2116,6 +2116,26 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
|
*/
|
|
boolean isStopping();
|
|
|
|
+ // 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
|
|
+
|
|
/**
|
|
* Returns the {@link com.destroystokyo.paper.entity.ai.MobGoals} manager
|
|
*
|