mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 13:07:06 +01:00
31 lines
1.7 KiB
Diff
31 lines
1.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
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
|
|
index 8f427475f7418bbfb8121dbd3e25e7827775ea41..447b8f9ede3f57c6c5f968a0d25153c5c8770c5a 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -1482,6 +1482,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
}
|
|
|
|
+ new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper - Server Tick Events
|
|
++this.tickCount;
|
|
this.tickRateManager.tick();
|
|
this.tickChildren(shouldKeepTicking);
|
|
@@ -1498,6 +1499,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
ProfilerFiller gameprofilerfiller = Profiler.get();
|
|
|
|
this.runAllTasks(); // Paper - move runAllTasks() into full server tick (previously for timings)
|
|
+ // 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
|
|
gameprofilerfiller.push("tallying");
|
|
long k = Util.getNanos() - i;
|
|
int l = this.tickCount % 100;
|