mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 04:02:50 +01:00
eb71c5fa3b
Move oversleep and all task execution back into the timed area...
35 lines
1.4 KiB
Diff
35 lines
1.4 KiB
Diff
From 335fc27d048916fe0dead7f191e5af9c18f5b4ba 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 4d604bd0e..2a8e097f9 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -1087,6 +1087,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
});
|
|
MinecraftTimings.serverOversleep.stopTiming();
|
|
// Paper end
|
|
+ new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.ticks+1).callEvent(); // Paper
|
|
|
|
++this.ticks;
|
|
this.b(booleansupplier);
|
|
@@ -1130,6 +1131,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
}
|
|
// Paper end
|
|
|
|
+ // 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
|
|
+
|
|
this.methodProfiler.enter("tallying");
|
|
long l = this.f[this.ticks % 100] = SystemUtils.getMonotonicNanos() - i;
|
|
|
|
--
|
|
2.26.0
|
|
|