From c3730616ee72b4e6e6b4f59654519d653791bc34 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 15 Sep 2015 19:52:51 +1000 Subject: SPIGOT-625: Insert a small delay when shutting down to allow packets to have a better chance at sending. --- nms-patches/MinecraftServer.patch | 57 ++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 25 deletions(-) (limited to 'nms-patches/MinecraftServer.patch') diff --git a/nms-patches/MinecraftServer.patch b/nms-patches/MinecraftServer.patch index a7d37f4f..2568fdd3 100644 --- a/nms-patches/MinecraftServer.patch +++ b/nms-patches/MinecraftServer.patch @@ -321,7 +321,14 @@ if (this.aq() != null) { this.aq().b(); } -@@ -309,11 +466,13 @@ +@@ -303,17 +460,20 @@ + MinecraftServer.LOGGER.info("Saving players"); + this.v.savePlayers(); + this.v.u(); ++ try { Thread.sleep(100); } catch (InterruptedException ex) {} // CraftBukkit - SPIGOT-625 - give server at least a chance to send packets + } + + if (this.worldServer != null) { MinecraftServer.LOGGER.info("Saving worlds"); this.saveChunks(false); @@ -335,7 +342,7 @@ } if (this.n.d()) { -@@ -354,6 +513,7 @@ +@@ -354,6 +514,7 @@ long k = j - this.ab; if (k > 2000L && this.ab - this.R >= 15000L) { @@ -343,7 +350,7 @@ MinecraftServer.LOGGER.warn("Can\'t keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)", new Object[] { Long.valueOf(k), Long.valueOf(k / 50L)}); k = 2000L; this.R = this.ab; -@@ -366,11 +526,12 @@ +@@ -366,11 +527,12 @@ i += k; this.ab = j; @@ -357,7 +364,7 @@ i -= 50L; this.A(); } -@@ -408,6 +569,12 @@ +@@ -408,6 +570,12 @@ } catch (Throwable throwable1) { MinecraftServer.LOGGER.error("Exception stopping the server", throwable1); } finally { @@ -370,7 +377,7 @@ this.z(); } -@@ -447,7 +614,7 @@ +@@ -447,7 +615,7 @@ protected void z() {} @@ -379,7 +386,7 @@ long i = System.nanoTime(); ++this.ticks; -@@ -473,7 +640,7 @@ +@@ -473,7 +641,7 @@ this.r.b().a(agameprofile); } @@ -388,7 +395,7 @@ this.methodProfiler.a("save"); this.v.savePlayers(); this.saveChunks(true); -@@ -508,20 +675,40 @@ +@@ -508,20 +676,40 @@ this.methodProfiler.c("levels"); @@ -432,7 +439,7 @@ this.methodProfiler.a("tick"); -@@ -548,9 +735,9 @@ +@@ -548,9 +736,9 @@ worldserver.getTracker().updatePlayers(); this.methodProfiler.b(); this.methodProfiler.b(); @@ -444,7 +451,7 @@ } this.methodProfiler.c("connection"); -@@ -574,10 +761,11 @@ +@@ -574,10 +762,11 @@ this.p.add(iupdateplayerlistbox); } @@ -457,7 +464,7 @@ boolean flag = true; String s = null; String s1 = "."; -@@ -655,15 +843,38 @@ +@@ -655,15 +844,38 @@ dedicatedserver.stop(); } }); @@ -497,7 +504,7 @@ } public File d(String s) { -@@ -679,7 +890,14 @@ +@@ -679,7 +891,14 @@ } public WorldServer getWorldServer(int i) { @@ -513,7 +520,7 @@ } public String E() { -@@ -715,7 +933,7 @@ +@@ -715,7 +934,7 @@ } public boolean isDebugging() { @@ -522,7 +529,7 @@ } public void g(String s) { -@@ -730,7 +948,7 @@ +@@ -730,7 +949,7 @@ } public String getServerModName() { @@ -531,7 +538,7 @@ } public CrashReport b(CrashReport crashreport) { -@@ -759,6 +977,7 @@ +@@ -759,6 +978,7 @@ } public List tabCompleteCommand(ICommandListener icommandlistener, String s, BlockPosition blockposition) { @@ -539,7 +546,7 @@ ArrayList arraylist = Lists.newArrayList(); if (s.startsWith("/")) { -@@ -797,6 +1016,9 @@ +@@ -797,6 +1017,9 @@ return arraylist; } @@ -549,7 +556,7 @@ } public static MinecraftServer getServer() { -@@ -804,7 +1026,7 @@ +@@ -804,7 +1027,7 @@ } public boolean O() { @@ -558,7 +565,7 @@ } public String getName() { -@@ -860,8 +1082,10 @@ +@@ -860,8 +1083,10 @@ } public void a(EnumDifficulty enumdifficulty) { @@ -571,7 +578,7 @@ if (worldserver != null) { if (worldserver.getWorldData().isHardcore()) { -@@ -903,15 +1127,17 @@ +@@ -903,15 +1128,17 @@ this.N = true; this.getConvertable().d(); @@ -593,7 +600,7 @@ this.safeShutdown(); } -@@ -944,9 +1170,11 @@ +@@ -944,9 +1171,11 @@ int i = 0; if (this.worldServer != null) { @@ -608,7 +615,7 @@ WorldData worlddata = worldserver.getWorldData(); mojangstatisticsgenerator.a("world[" + i + "][dimension]", Integer.valueOf(worldserver.worldProvider.getDimension())); -@@ -979,7 +1207,7 @@ +@@ -979,7 +1208,7 @@ public abstract boolean ae(); public boolean getOnlineMode() { @@ -617,7 +624,7 @@ } public void setOnlineMode(boolean flag) { -@@ -1051,8 +1279,9 @@ +@@ -1051,8 +1280,9 @@ } public void setGamemode(WorldSettings.EnumGamemode worldsettings_enumgamemode) { @@ -629,7 +636,7 @@ } } -@@ -1084,7 +1313,7 @@ +@@ -1084,7 +1314,7 @@ } public World getWorld() { @@ -638,7 +645,7 @@ } public Entity f() { -@@ -1155,8 +1384,10 @@ +@@ -1155,8 +1385,10 @@ WorldServer[] aworldserver = this.worldServer; int i = aworldserver.length; @@ -651,7 +658,7 @@ if (worldserver != null) { Entity entity = worldserver.getEntity(uuid); -@@ -1171,7 +1402,7 @@ +@@ -1171,7 +1403,7 @@ } public boolean getSendCommandFeedback() { @@ -660,7 +667,7 @@ } public void a(CommandObjectiveExecutor.EnumCommandResult commandobjectiveexecutor_enumcommandresult, int i) {} -@@ -1182,7 +1413,7 @@ +@@ -1182,7 +1414,7 @@ public ListenableFuture a(Callable callable) { Validate.notNull(callable); -- cgit v1.2.3