aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0285-Server-Tick-Events.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0285-Server-Tick-Events.patch')
-rw-r--r--patches/server/0285-Server-Tick-Events.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/patches/server/0285-Server-Tick-Events.patch b/patches/server/0285-Server-Tick-Events.patch
new file mode 100644
index 0000000000..afbd125410
--- /dev/null
+++ b/patches/server/0285-Server-Tick-Events.patch
@@ -0,0 +1,31 @@
+From 0000000000000000000000000000000000000000 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 bd882ebb8e24de671518bf6b12f9ee4bc3f35128..3ffb330a16797c04694f73b0cd9f5b38a07641b4 100644
+--- a/src/main/java/net/minecraft/server/MinecraftServer.java
++++ b/src/main/java/net/minecraft/server/MinecraftServer.java
+@@ -1435,6 +1435,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
+ });
+ isOversleep = false;MinecraftTimings.serverOversleep.stopTiming();
+ // Paper end
++ new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper - Server Tick Events
+
+ ++this.tickCount;
+ this.tickRateManager.tick();
+@@ -1460,6 +1461,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
+ this.runAllTasks();
+ }
+ // Paper end
++ // Paper start - Server Tick Events
++ long endTime = System.nanoTime();
++ long remaining = (TICK_TIME - (endTime - lastTick)) - catchupTime;
++ new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent();
++ // Paper end - Server Tick Events
+ this.profiler.push("tallying");
+ long j = Util.getNanos() - i;
+ int k = this.tickCount % 100;