aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0429-Server-Tick-Events.patch
diff options
context:
space:
mode:
Diffstat (limited to 'Spigot-Server-Patches/0429-Server-Tick-Events.patch')
-rw-r--r--Spigot-Server-Patches/0429-Server-Tick-Events.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0429-Server-Tick-Events.patch b/Spigot-Server-Patches/0429-Server-Tick-Events.patch
new file mode 100644
index 0000000000..afc6fba092
--- /dev/null
+++ b/Spigot-Server-Patches/0429-Server-Tick-Events.patch
@@ -0,0 +1,34 @@
+From 0051bbc2ee1699aed51c6ca5dddb1a3f033aa444 Mon Sep 17 00:00:00 2001
+From: Aikar <[email protected]>
+Date: Wed, 27 Mar 2019 22:48:45 -0400
+Subject: [PATCH] Server Tick Events
+
+Fires event at start and end of a server tick
+
+diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
+index b93fccf919..d6250c4722 100644
+--- a/src/main/java/net/minecraft/server/MinecraftServer.java
++++ b/src/main/java/net/minecraft/server/MinecraftServer.java
+@@ -927,6 +927,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
+ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper
+ this.slackActivityAccountant.tickStarted(); // Spigot
+ long i = SystemUtils.getMonotonicNanos(); long startTime = i; // Paper
++ new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.ticks+1).callEvent(); // Paper
+
+ ++this.ticks;
+ if (this.S) {
+@@ -995,6 +996,11 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
+ PaperLightingQueue.processQueue(startTime); // Paper
+ expiringMaps.removeIf(ExpiringMap::clean); // Paper
+ this.slackActivityAccountant.tickEnded(l); // Spigot
++ // Paper start
++ long endTime = System.nanoTime();
++ long remaining = (TICK_TIME - (endTime - lastTick)) - catchupTime;
++ new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.ticks, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent();
++ // Paper end
+ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper
+ }
+
+--
+2.21.0
+