mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 18:45:54 +01:00
4e958e229f
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: zml <zml@stellardrift.ca> Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
33 lines
1.5 KiB
Diff
33 lines
1.5 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 93aa20d82d867fee6df938096b0ad64d061fc61a..c4f1fa6bd54a1928d163d83807f2823029db54e6 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -1118,6 +1118,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
});
|
|
isOversleep = false;MinecraftTimings.serverOversleep.stopTiming();
|
|
// Paper end
|
|
+ new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.ticks+1).callEvent(); // Paper
|
|
|
|
++this.ticks;
|
|
this.b(booleansupplier);
|
|
@@ -1161,6 +1162,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.h[this.ticks % 100] = SystemUtils.getMonotonicNanos() - i;
|
|
|