Paper/patches/api/0013-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
2022-12-07 17:46:46 +01:00
index 71a09ed2b9863d2d339967f41ab6373ec27429d3..397f57f0ab4844fb88c60681bf6e6e3db8a98945 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
2022-12-07 17:46:46 +01:00
@@ -1891,6 +1891,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
2022-12-07 17:46:46 +01:00
index a4f8035b40eebff8afe01788781128b04247f28c..3f3531e208472a0e76f76e2b1a08a699527cef8f 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
2022-12-07 17:46:46 +01:00
@@ -1605,6 +1605,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.
*