Add server oversleep to timings (#2509)

Now everything except waiting for the next tick should be included
in timings
This commit is contained in:
Spottedleaf 2019-09-29 13:49:38 -07:00 committed by Zach
parent 1d2a5915ed
commit 43ec79a32c
13 changed files with 115 additions and 76 deletions

View File

@ -1,4 +1,4 @@
From 07b31610596dc222d66d78b3b1e468314d3157e8 Mon Sep 17 00:00:00 2001
From 0c34b70f8d3e5b2d85148ffae2ee45dd4f77763f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Mar 2016 04:00:11 -0600
Subject: [PATCH] Timings v2
@ -6,10 +6,10 @@ Subject: [PATCH] Timings v2
diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java
new file mode 100644
index 0000000000..c2d2614181
index 0000000000..c6818bc86a
--- /dev/null
+++ b/src/main/java/co/aikar/timings/MinecraftTimings.java
@@ -0,0 +1,134 @@
@@ -0,0 +1,135 @@
+package co.aikar.timings;
+
+import com.google.common.collect.MapMaker;
@ -24,6 +24,7 @@ index 0000000000..c2d2614181
+// TODO: Re-implement missing timers
+public final class MinecraftTimings {
+
+ public static final Timing serverOversleep = Timings.ofSafe("Server Oversleep");
+ public static final Timing playerListTimer = Timings.ofSafe("Player List");
+ public static final Timing commandFunctionsTimer = Timings.ofSafe("Command Functions");
+ public static final Timing connectionTimer = Timings.ofSafe("Connection Handler");
@ -724,7 +725,7 @@ index 2b13f4c9f9..47379046dc 100644
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index cec3794cd4..bc0e483a2a 100644
index cec3794cd4..c76f262db9 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -63,7 +63,7 @@ import org.bukkit.craftbukkit.CraftServer;
@ -736,6 +737,17 @@ index cec3794cd4..bc0e483a2a 100644
import org.spigotmc.SlackActivityAccountant; // Spigot
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements IMojangStatistics, ICommandListener, AutoCloseable, Runnable {
@@ -128,8 +128,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
});
});
private long nextTick = SystemUtils.getMonotonicMillis();
- private long ab;
- private boolean ac;
+ private long ab; final long getTickOversleepMaxTime() { return this.ab; } // Paper - OBFHELPER
+ private boolean ac; final boolean hasExecutedTask() { return this.ac; } // Paper - OBFHELPER
private final IReloadableResourceManager ae;
private final ResourcePackRepository<ResourcePackLoader> resourcePackRepository;
@Nullable
@@ -685,6 +685,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
}
// CraftBukkit end
@ -744,25 +756,52 @@ index cec3794cd4..bc0e483a2a 100644
// CraftBukkit start
if (this.server != null) {
this.server.disablePlugins();
@@ -882,7 +883,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -875,6 +876,16 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
return this.forceTicks || this.isEntered() || SystemUtils.getMonotonicMillis() < (this.ac ? this.ab : this.nextTick);
}
+ // Paper start
+ private boolean canOversleep() {
+ return this.hasExecutedTask() && SystemUtils.getMonotonicMillis() < this.getTickOversleepMaxTime();
+ }
+
+ private boolean canSleepForTickNoOversleep() {
+ return this.forceTicks || this.isEntered() || SystemUtils.getMonotonicMillis() < this.nextTick;
+ }
+ // Paper end
+
private void executeModerately() {
this.executeAll();
java.util.concurrent.locks.LockSupport.parkNanos("executing tasks", 1000L);
@@ -882,9 +893,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// CraftBukkit end
protected void sleepForTick() {
- this.executeAll();
+ //this.executeAll(); // Paper - move this into the tick method for timings
this.awaitTasks(() -> {
return !this.canSleepForTick();
- return !this.canSleepForTick();
+ return !this.canSleepForTickNoOversleep(); // Paper - move oversleep into full server tick
});
@@ -962,7 +963,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
}
@@ -962,7 +973,14 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
protected void exit() {}
protected void a(BooleanSupplier booleansupplier) {
- SpigotTimings.serverTickTimer.startTiming(); // Spigot
+ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper
+ // Paper start - move oversleep into full server tick
+ MinecraftTimings.serverOversleep.startTiming();
+ this.awaitTasks(() -> {
+ return !this.canOversleep();
+ });
+ MinecraftTimings.serverOversleep.stopTiming();
+ // Paper end
this.slackActivityAccountant.tickStarted(); // Spigot
long i = SystemUtils.getMonotonicNanos();
@@ -983,14 +984,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -983,14 +1001,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
}
if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit
@ -777,7 +816,7 @@ index cec3794cd4..bc0e483a2a 100644
}
this.methodProfiler.enter("snooper");
@@ -1013,30 +1012,34 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1013,30 +1029,34 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.methodProfiler.exit();
org.spigotmc.WatchdogThread.tick(); // Spigot
this.slackActivityAccountant.tickEnded(l); // Spigot
@ -821,7 +860,7 @@ index cec3794cd4..bc0e483a2a 100644
// Send time updates to everyone, it will get the right time from the world the player is in.
if (this.ticks % 20 == 0) {
for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
@@ -1044,7 +1047,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1044,7 +1064,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime(), entityplayer.world.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE))); // Add support for per player time
}
}
@ -830,7 +869,7 @@ index cec3794cd4..bc0e483a2a 100644
while (iterator.hasNext()) {
WorldServer worldserver = (WorldServer) iterator.next();
@@ -1087,20 +1090,20 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1087,20 +1107,20 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
}
this.methodProfiler.exitEnter("connection");
@ -1166,7 +1205,7 @@ index 1d5e4c5127..60c222b12b 100644
CrashReport crashreport = CrashReport.a(throwable, "Ticking entity");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being ticked");
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 825e72e53a..a28c97a889 100644
index 08f824228b..8a7e666473 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1,5 +1,7 @@
@ -1761,5 +1800,5 @@ index ca7789b5e0..4423839697 100644
}
}
--
2.22.0
2.22.1

View File

@ -1,4 +1,4 @@
From 081cf8b1dbc585e75685cf8223bb04a9944bdb38 Mon Sep 17 00:00:00 2001
From 92c1237326e854ad3b8cba593fd5cb16bed1a6e0 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 1 Mar 2016 14:32:43 -0600
Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang
@ -6,7 +6,7 @@ Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang
diff --git a/src/main/java/net/minecraft/server/EULA.java b/src/main/java/net/minecraft/server/EULA.java
index 3f35a28b..cf00f35a 100644
index 3f35a28ba1..cf00f35a5b 100644
--- a/src/main/java/net/minecraft/server/EULA.java
+++ b/src/main/java/net/minecraft/server/EULA.java
@@ -70,7 +70,7 @@ public class EULA {
@ -19,10 +19,10 @@ index 3f35a28b..cf00f35a 100644
throwable = throwable1;
throw throwable1;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index bc0e483a..d7c00066 100644
index c76f262db9..11048c37f1 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1301,7 +1301,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1318,7 +1318,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
}
public String getServerModName() {
@ -32,7 +32,7 @@ index bc0e483a..d7c00066 100644
public CrashReport b(CrashReport crashreport) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index a59f61e7..f49bd144 100644
index a59f61e73a..f49bd144ff 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -196,7 +196,7 @@ import org.yaml.snakeyaml.error.MarkedYAMLException;
@ -45,7 +45,7 @@ index a59f61e7..f49bd144 100644
private final String bukkitVersion = Versioning.getBukkitVersion();
private final Logger logger = Logger.getLogger("Minecraft");
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 0e33cb36..7a1dc33c 100644
index 5fe81e42ab..05f9f90551 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -200,12 +200,25 @@ public class Main {
@ -76,7 +76,7 @@ index 0e33cb36..7a1dc33c 100644
MinecraftServer.main(options);
} catch (Throwable t) {
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index 27297204..70b18719 100644
index 27297204f1..70b187190f 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -19,7 +19,7 @@ public class WatchdogThread extends Thread
@ -116,5 +116,5 @@ index 27297204..70b18719 100644
log.log( Level.SEVERE, "------------------------------" );
//
--
2.22.0
2.22.1

View File

@ -1,4 +1,4 @@
From 2aab0c3c063b1d75f7d802c8daa63ae29e88a110 Mon Sep 17 00:00:00 2001
From e19b758424d8aaf7798cc97d3f673ff9565313b3 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Wed, 2 Mar 2016 11:59:48 -0600
Subject: [PATCH] Optimize explosions
@ -123,10 +123,10 @@ index cdd8939504..bd6a0bd16b 100644
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 6594138f35..55d10058f5 100644
index 64c961e5b5..f56edde789 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1145,6 +1145,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1162,6 +1162,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.methodProfiler.exit();
this.methodProfiler.exit();
@ -155,5 +155,5 @@ index 5fea828de0..ee869a769f 100644
public CraftWorld getWorld() {
return this.world;
--
2.22.0
2.22.1

View File

@ -1,4 +1,4 @@
From 73e6613f2094496f99ac2c93ca84523bfee82c9f Mon Sep 17 00:00:00 2001
From 59720392862f30ce48a11dcbece3f04e69814f5b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 19:55:45 -0400
Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener
@ -32,10 +32,10 @@ index ef392f5fe8..227fe073fd 100644
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 55d10058f5..fe50d4ff71 100644
index f56edde789..34be67417d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1111,6 +1111,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1128,6 +1128,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
while (iterator.hasNext()) {
WorldServer worldserver = (WorldServer) iterator.next();
@ -66,7 +66,7 @@ index c40777ecb8..cb5515dc3b 100644
this.getServer().getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index ee74a677a3..81f8373985 100644
index 0c7fe7c55e..362cb6bf8b 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -71,6 +71,7 @@ public class WorldServer extends World {
@ -78,5 +78,5 @@ index ee74a677a3..81f8373985 100644
// Add env and gen to constructor
public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
--
2.22.0
2.22.1

View File

@ -1,4 +1,4 @@
From 5abf16f7dce2b01baec6c3435941df78b58fc9af Mon Sep 17 00:00:00 2001
From 2a5c0c28e79e357361e9179b4291881df81cc6c6 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 28 Apr 2016 00:57:27 -0400
Subject: [PATCH] remove null possibility for getServer singleton
@ -6,7 +6,7 @@ Subject: [PATCH] remove null possibility for getServer singleton
to stop IDE complaining about potential NPE
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e3bd80c934..17b9e9a31d 100644
index b4eb53f28a..fbad6a31c1 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -68,6 +68,7 @@ import org.spigotmc.SlackActivityAccountant; // Spigot
@ -25,7 +25,7 @@ index e3bd80c934..17b9e9a31d 100644
this.resourcePackRepository = new ResourcePackRepository<>(ResourcePackLoader::new);
this.ai = new CraftingManager();
this.aj = new TagRegistry();
@@ -2123,7 +2125,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -2140,7 +2142,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@Deprecated
public static MinecraftServer getServer() {
@ -35,5 +35,5 @@ index e3bd80c934..17b9e9a31d 100644
// CraftBukkit end
}
--
2.22.0
2.22.1

View File

@ -1,4 +1,4 @@
From 0200910eb828793d2cec73d86c74afecef8c1fce Mon Sep 17 00:00:00 2001
From f18f263e2f7704568f3a05f32bb37ba1da25e400 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Fri, 9 Jun 2017 19:03:43 +0200
Subject: [PATCH] Use TerminalConsoleAppender for console improvements
@ -185,7 +185,7 @@ index 895049287c..92d0aa6d66 100644
System.setOut(new PrintStream(new LoggerOutputStream(logger, Level.INFO), true));
System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true));
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index f621350ea6..8fcffc9fa3 100644
index 759c713976..6c9a43d66b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -57,7 +57,7 @@ import org.apache.commons.lang3.Validate;
@ -234,7 +234,7 @@ index f621350ea6..8fcffc9fa3 100644
} catch (Exception ignored) {
}
// CraftBukkit end
@@ -1429,7 +1433,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1446,7 +1450,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@Override
public void sendMessage(IChatBaseComponent ichatbasecomponent) {
@ -284,7 +284,7 @@ index 8e6f23d278..4c94e85e46 100644
@Override
public PluginCommand getPluginCommand(String name) {
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index ad1da9ddd3..d2bdd7c73f 100644
index 78534c307c..c1ece9acd4 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -13,7 +13,7 @@ import java.util.logging.Logger;
@ -599,5 +599,5 @@ index 490a9acc70..08b6bb7f97 100644
<AppenderRef ref="TerminalConsole" level="info"/>
</Root>
--
2.22.0
2.22.1

View File

@ -1,4 +1,4 @@
From 0009ced384917a226d1a1694eab6b1d8f1241678 Mon Sep 17 00:00:00 2001
From de22020424bc3d2831d68f812df2172635cc433b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 15 Jan 2018 22:11:48 -0500
Subject: [PATCH] Basic PlayerProfile API
@ -429,10 +429,10 @@ index 1f6a126329..6d278a0da5 100644
* Calculates distance between 2 entities
* @param e1
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8fcffc9fa3..32a9e54d0a 100644
index 6c9a43d66b..6e6c662f95 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1260,7 +1260,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1277,7 +1277,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
DispenserRegistry.init();
DispenserRegistry.c();
String s = "."; // PAIL?
@ -441,7 +441,7 @@ index 8fcffc9fa3..32a9e54d0a 100644
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
UserCache usercache = new UserCache(gameprofilerepository, new File(s, MinecraftServer.b.getName()));
@@ -1720,6 +1720,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1737,6 +1737,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.H = i;
}
@ -525,5 +525,5 @@ index f891b1346c..308ae2e157 100644
// Paper end
}
--
2.22.0
2.22.1

View File

@ -1,4 +1,4 @@
From d041c59da4e509e0633e7380feb6c02c4a8a20e8 Mon Sep 17 00:00:00 2001
From a48b6bb616cd974110b453c1d7fdd78ca31638f5 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Wed, 11 Oct 2017 15:56:26 +0200
Subject: [PATCH] Implement extended PaperServerListPingEvent
@ -177,7 +177,7 @@ index 0000000000..a85466bc7e
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 32a9e54d0a..37353b29da 100644
index 6e6c662f95..8d2be704f9 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1,6 +1,9 @@
@ -190,7 +190,7 @@ index 32a9e54d0a..37353b29da 100644
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.gson.JsonElement;
@@ -1058,7 +1061,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1075,7 +1078,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
if (i - this.Z >= 5000000000L) {
this.Z = i;
this.serverPing.setPlayerSample(new ServerPing.ServerPingPlayerSample(this.getMaxPlayers(), this.getPlayerCount()));
@ -261,5 +261,5 @@ index 783aa6db1f..33767c85ca 100644
}
--
2.22.0
2.22.1

View File

@ -1,4 +1,4 @@
From 57e4e704f0bd0d50d54eb66b0050a85a0e7ca8a6 Mon Sep 17 00:00:00 2001
From 940cf3172b52e2988e9f34921ce7cca05de151aa Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 27 Apr 2016 22:09:52 -0400
Subject: [PATCH] Optimize Hoppers
@ -47,10 +47,10 @@ index c69a067ef1..1e23d77e72 100644
itemstack.d(this.C());
if (this.tag != null) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 2acb71fa8a..0d690fc8e1 100644
index 6f410ca921..c075780674 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1143,6 +1143,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1160,6 +1160,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
WorldServer worldserver = (WorldServer) iterator.next();
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
@ -299,5 +299,5 @@ index 1ba98bf736..6f6519f6c5 100644
flag = true;
} else if (a(itemstack1, itemstack)) {
--
2.22.0
2.22.1

View File

@ -1,4 +1,4 @@
From 7d5f5c45416e21cfe63aa30f352310a28faee015 Mon Sep 17 00:00:00 2001
From 1fd27d18045b686f8e5af4caf00cce897e9fb136 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 2 Nov 2018 23:11:51 -0400
Subject: [PATCH] Optimize World Time Updates
@ -8,10 +8,10 @@ the updates per world, so that we can re-use the same packet
object for every player unless they have per-player time enabled.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index a5447c6501..aec871dd24 100644
index 40260dbd48..a7b63ab421 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1130,12 +1130,24 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1147,12 +1147,24 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot // Paper
// Send time updates to everyone, it will get the right time from the world the player is in.
@ -41,5 +41,5 @@ index a5447c6501..aec871dd24 100644
while (iterator.hasNext()) {
--
2.22.0
2.22.1

View File

@ -1,4 +1,4 @@
From e22bb304de24d0f80e9884d55d88b271e78d404f Mon Sep 17 00:00:00 2001
From ff943edcb4161947dfae5545652ab4b9c2415a9a 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
@ -6,18 +6,18 @@ 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 aec871dd24..35c5d38c21 100644
index a7b63ab421..24dccfb7a1 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1055,6 +1055,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper
@@ -1072,6 +1072,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// Paper end
this.slackActivityAccountant.tickStarted(); // Spigot
long i = SystemUtils.getMonotonicNanos();
+ new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.ticks+1).callEvent(); // Paper
++this.ticks;
this.b(booleansupplier);
@@ -1106,6 +1107,11 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1123,6 +1124,11 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.executeAll();
}
// Paper end
@ -30,5 +30,5 @@ index aec871dd24..35c5d38c21 100644
}
--
2.22.0
2.22.1

View File

@ -1,4 +1,4 @@
From 3de070a84f4e03c4f82c2538e87c3ac3c7da769a Mon Sep 17 00:00:00 2001
From 046a05122f1c0f770d9264ec32064c9631b3f9bf Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Mon, 13 May 2019 21:10:59 -0700
Subject: [PATCH] Fix CraftServer#isPrimaryThread and MinecraftServer
@ -16,10 +16,10 @@ handling that should have been handled synchronously will be handled
synchronously when the server gets shut down.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 35c5d38c2..c70ab3caf 100644
index 24dccfb7a1..ee02001700 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2154,7 +2154,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -2171,7 +2171,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// CraftBukkit start
@Override
public boolean isMainThread() {
@ -29,7 +29,7 @@ index 35c5d38c2..c70ab3caf 100644
@Deprecated
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index b89486beb..7a8ab7d40 100644
index b89486beb1..7a8ab7d401 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1664,7 +1664,7 @@ public final class CraftServer implements Server {
@ -42,5 +42,5 @@ index b89486beb..7a8ab7d40 100644
@Override
--
2.23.0
2.22.1

View File

@ -1,11 +1,11 @@
From 7f430df08b80759b01c0a2db3938dc79d0858816 Mon Sep 17 00:00:00 2001
From 1c28bef1ac334a0c2a67b80d251ff42652b004e6 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 9 Jun 2019 03:53:22 +0100
Subject: [PATCH] incremental chunk saving
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index de11a91af..4d3c6c6b4 100644
index de11a91af6..4d3c6c6b47 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -489,4 +489,19 @@ public class PaperWorldConfig {
@ -29,7 +29,7 @@ index de11a91af..4d3c6c6b4 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index ee8f80174..2003522d9 100644
index ee8f801745..2003522d96 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -42,7 +42,7 @@ public class Chunk implements IChunkAccess {
@ -42,7 +42,7 @@ index ee8f80174..2003522d9 100644
private long t;
@Nullable
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 162700313..535c2258b 100644
index 1627003134..535c2258b9 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -335,6 +335,15 @@ public class ChunkProviderServer extends IChunkProvider {
@ -62,7 +62,7 @@ index 162700313..535c2258b 100644
public void close() throws IOException {
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index c58f6f50d..229336040 100644
index 098b3e5355..ccf359dff1 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -165,6 +165,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@ -73,7 +73,7 @@ index c58f6f50d..229336040 100644
public File bukkitDataPackFolder;
public CommandDispatcher vanillaCommandDispatcher;
private boolean forceTicks;
@@ -1085,14 +1086,28 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1102,14 +1103,28 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.serverPing.b().a(agameprofile);
}
@ -106,7 +106,7 @@ index c58f6f50d..229336040 100644
this.methodProfiler.enter("snooper");
if (((DedicatedServer) this).getDedicatedServerProperties().snooperEnabled && !this.snooper.d() && this.ticks > 100) { // Spigot
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 493770bf6..2be6fa0f0 100644
index 493770bf68..2be6fa0f07 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -297,6 +297,36 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@ -147,7 +147,7 @@ index 493770bf6..2be6fa0f0 100644
if (flag) {
List<PlayerChunk> list = (List) this.visibleChunks.values().stream().filter(PlayerChunk::hasBeenLoaded).peek(PlayerChunk::m).collect(Collectors.toList());
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 8a3124fed..e4cc24806 100644
index 8a3124fed4..e4cc24806e 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -756,11 +756,44 @@ public class WorldServer extends World {
@ -197,5 +197,5 @@ index 8a3124fed..e4cc24806 100644
if (iprogressupdate != null) {
iprogressupdate.a(new ChatMessage("menu.savingLevel", new Object[0]));
--
2.23.0
2.22.1