2020-04-02 23:07:06 +02:00
|
|
|
From de744a76882cd1dcede8acef0c51adaf42d9f839 Mon Sep 17 00:00:00 2001
|
2019-03-28 03:49:29 +01:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
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
|
2020-04-02 23:07:06 +02:00
|
|
|
index 2a01e609c6..2801a3ee69 100644
|
2019-03-28 03:49:29 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
2020-01-22 03:02:07 +01:00
|
|
|
@@ -1086,6 +1086,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
2019-09-29 22:49:38 +02:00
|
|
|
// Paper end
|
2019-03-28 03:49:29 +01:00
|
|
|
this.slackActivityAccountant.tickStarted(); // Spigot
|
2019-05-05 19:19:34 +02:00
|
|
|
long i = SystemUtils.getMonotonicNanos();
|
2019-03-28 03:49:29 +01:00
|
|
|
+ new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.ticks+1).callEvent(); // Paper
|
|
|
|
|
|
|
|
++this.ticks;
|
2019-05-05 19:19:34 +02:00
|
|
|
this.b(booleansupplier);
|
2020-01-22 03:02:07 +01:00
|
|
|
@@ -1137,6 +1138,11 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
2019-07-24 05:20:14 +02:00
|
|
|
this.executeAll();
|
|
|
|
}
|
|
|
|
// Paper end
|
2019-03-28 03:49:29 +01:00
|
|
|
+ // Paper start
|
|
|
|
+ long endTime = System.nanoTime();
|
|
|
|
+ long remaining = (TICK_TIME - (endTime - lastTick)) - catchupTime;
|
2019-03-28 06:27:39 +01:00
|
|
|
+ new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.ticks, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent();
|
2019-03-28 03:49:29 +01:00
|
|
|
+ // Paper end
|
|
|
|
co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper
|
|
|
|
}
|
|
|
|
|
|
|
|
--
|
2020-03-15 21:03:36 +01:00
|
|
|
2.25.1
|
2019-03-28 03:49:29 +01:00
|
|
|
|