PaperMC/patches/api/0010-Add-getTPS-method.patch
2022-07-21 20:53:04 +01:00

49 lines
1.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 29 Feb 2016 17:24:57 -0600
Subject: [PATCH] Add getTPS method
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index aecc0bcaeceb0a2db08a528244c08037e58f399b..fcdce3b516821d42327452790cc66663e4677613 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1876,6 +1876,17 @@ public final class Bukkit {
return server.getEntity(uuid);
}
+ // Paper start
+ /**
+ * Gets the current server TPS
+ * @return current server TPS (1m, 5m, 15m in Paper-Server)
+ */
+ @NotNull
+ public static double[] getTPS() {
+ return server.getTPS();
+ }
+ // Paper end
+
/**
* Get the advancement specified by this key.
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index b8c47ed7eb7bf52efd1928956584fd993e59f03a..f52dd4c4602638bf02f676f6415d7051c0439cce 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1592,6 +1592,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@Nullable
Entity getEntity(@NotNull UUID uuid);
+ // Paper start
+ /**
+ * Gets the current server TPS
+ *
+ * @return current server TPS (1m, 5m, 15m in Paper-Server)
+ */
+ @NotNull
+ public double[] getTPS();
+ // Paper end
+
/**
* Get the advancement specified by this key.
*