Paper/patches/api/0014-Add-getTPS-method.patch

50 lines
1.5 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
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 f9545a52bc822af03182f8d18231e02b7348c90f..cb6433792786540e7bf667e466d6642e73ca8df0 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2050,6 +2050,17 @@ public final class Bukkit {
2021-06-11 14:02:28 +02:00
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 9b887115c90ed80b391f414b1b9db85b2b9e85ee..b8871820aab10f5d8d167e661e73b671204e9b4f 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1749,6 +1749,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
2021-06-11 14:02:28 +02:00
@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.
*