diff --git a/nms-patches/MinecraftServer.patch b/nms-patches/MinecraftServer.patch index ba09fd9cc1..62e89f5021 100644 --- a/nms-patches/MinecraftServer.patch +++ b/nms-patches/MinecraftServer.patch @@ -134,7 +134,7 @@ WorldNBTStorage worldnbtstorage = this.getConvertable().a(s, this); this.a(this.getWorld(), worldnbtstorage); -@@ -277,24 +324,134 @@ +@@ -277,24 +324,135 @@ } this.a(worldnbtstorage.getDirectory(), worlddata); @@ -262,6 +262,7 @@ - WorldServer worldserver = new WorldServer(this, this.executorService, worldnbtstorage, worlddata, DimensionManager.OVERWORLD, this.methodProfiler, worldloadlistener); + this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD); + this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP)); ++ this.serverConnection.acceptConnections(); + // CraftBukkit end - this.worldServer.put(DimensionManager.OVERWORLD, worldserver); @@ -282,7 +283,7 @@ if (!worlddata.u()) { try { -@@ -318,23 +475,8 @@ +@@ -318,23 +476,8 @@ worlddata.d(true); } @@ -307,7 +308,7 @@ private void a(WorldData worlddata) { worlddata.f(false); -@@ -353,6 +495,23 @@ +@@ -353,6 +496,23 @@ protected void a(File file, WorldData worlddata) { this.resourcePackRepository.a((ResourcePackSource) (new ResourcePackSourceVanilla())); this.resourcePackFolder = new ResourcePackSourceFolder(new File(file, "datapacks")); @@ -331,7 +332,7 @@ this.resourcePackRepository.a((ResourcePackSource) this.resourcePackFolder); this.resourcePackRepository.a(); List list = Lists.newArrayList(); -@@ -373,11 +532,18 @@ +@@ -373,11 +533,18 @@ this.b(worlddata); } @@ -353,7 +354,7 @@ BlockPosition blockposition = worldserver.getSpawn(); worldloadlistener.a(new ChunkCoordIntPair(blockposition)); -@@ -388,17 +554,21 @@ +@@ -388,17 +555,21 @@ chunkproviderserver.addTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE); while (chunkproviderserver.b() != 441) { @@ -384,7 +385,7 @@ if (forcedchunk != null) { WorldServer worldserver1 = this.getWorldServer(dimensionmanager); -@@ -413,10 +583,16 @@ +@@ -413,10 +584,16 @@ } } @@ -403,7 +404,7 @@ } protected void a(String s, WorldNBTStorage worldnbtstorage) { -@@ -463,12 +639,16 @@ +@@ -463,12 +640,16 @@ } } @@ -420,7 +421,7 @@ return flag3; } -@@ -477,8 +657,29 @@ +@@ -477,8 +658,29 @@ this.stop(); } @@ -450,7 +451,7 @@ if (this.getServerConnection() != null) { this.getServerConnection().b(); } -@@ -487,6 +688,7 @@ +@@ -487,6 +689,7 @@ MinecraftServer.LOGGER.info("Saving players"); this.playerList.savePlayers(); this.playerList.shutdown(); @@ -458,7 +459,7 @@ } MinecraftServer.LOGGER.info("Saving worlds"); -@@ -556,14 +758,16 @@ +@@ -556,14 +759,16 @@ while (this.isRunning) { long i = SystemUtils.getMonotonicMillis() - this.nextTick; @@ -476,7 +477,7 @@ this.nextTick += 50L; if (this.T) { this.T = false; -@@ -610,6 +814,12 @@ +@@ -610,6 +815,12 @@ } catch (Throwable throwable1) { MinecraftServer.LOGGER.error("Exception stopping the server", throwable1); } finally { @@ -489,7 +490,7 @@ this.exit(); } -@@ -618,8 +828,15 @@ +@@ -618,8 +829,15 @@ } private boolean canSleepForTick() { @@ -506,7 +507,7 @@ protected void sleepForTick() { this.executeAll(); -@@ -720,7 +937,7 @@ +@@ -720,7 +938,7 @@ this.serverPing.b().a(agameprofile); } @@ -515,7 +516,7 @@ MinecraftServer.LOGGER.debug("Autosave started"); this.methodProfiler.enter("save"); this.playerList.savePlayers(); -@@ -750,23 +967,40 @@ +@@ -750,23 +968,40 @@ } protected void b(BooleanSupplier booleansupplier) { @@ -557,7 +558,7 @@ this.methodProfiler.enter("tick"); -@@ -805,7 +1039,8 @@ +@@ -805,7 +1040,8 @@ this.tickables.add(runnable); } @@ -567,7 +568,7 @@ OptionParser optionparser = new OptionParser(); OptionSpec optionspec = optionparser.accepts("nogui"); OptionSpec optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits"); -@@ -828,15 +1063,17 @@ +@@ -828,15 +1064,17 @@ optionparser.printHelpOn(System.err); return; } @@ -587,7 +588,7 @@ MinecraftServer.LOGGER.info("Initialized '" + java_nio_file_path.toAbsolutePath().toString() + "' and '" + java_nio_file_path1.toAbsolutePath().toString() + "'"); return; } -@@ -848,14 +1085,15 @@ +@@ -848,14 +1086,15 @@ DispenserRegistry.init(); DispenserRegistry.c(); @@ -606,7 +607,7 @@ dedicatedserver.i((String) optionset.valueOf(optionspec7)); dedicatedserver.setPort((Integer) optionset.valueOf(optionspec10)); dedicatedserver.e(optionset.has(optionspec2)); -@@ -878,6 +1116,29 @@ +@@ -878,6 +1117,29 @@ thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(MinecraftServer.LOGGER)); Runtime.getRuntime().addShutdownHook(thread); @@ -636,7 +637,7 @@ } catch (Exception exception) { MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception); } -@@ -897,7 +1158,9 @@ +@@ -897,7 +1159,9 @@ } public void startServerThread() { @@ -646,7 +647,7 @@ } public File d(String s) { -@@ -952,7 +1215,7 @@ +@@ -952,7 +1216,7 @@ } public String getServerModName() { @@ -655,7 +656,7 @@ } public CrashReport b(CrashReport crashreport) { -@@ -991,7 +1254,7 @@ +@@ -991,7 +1255,7 @@ } public boolean F() { @@ -664,7 +665,7 @@ } @Override -@@ -1690,4 +1953,16 @@ +@@ -1690,4 +1954,16 @@ } } diff --git a/nms-patches/ServerConnection.patch b/nms-patches/ServerConnection.patch new file mode 100644 index 0000000000..16c2e15d04 --- /dev/null +++ b/nms-patches/ServerConnection.patch @@ -0,0 +1,24 @@ +--- a/net/minecraft/server/ServerConnection.java ++++ b/net/minecraft/server/ServerConnection.java +@@ -77,10 +77,20 @@ + channel.pipeline().addLast("packet_handler", networkmanager); + networkmanager.setPacketListener(new HandshakeListener(ServerConnection.this.e, networkmanager)); + } +- }).group((EventLoopGroup) lazyinitvar.a()).localAddress(inetaddress, i)).bind().syncUninterruptibly()); ++ }).group((EventLoopGroup) lazyinitvar.a()).localAddress(inetaddress, i)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit + } + } + ++ // CraftBukkit start ++ public void acceptConnections() { ++ synchronized (this.f) { // PAIL: listeningChannels ++ for (ChannelFuture f : this.f) { ++ f.channel().config().setAutoRead(true); ++ } ++ } ++ } ++ // CraftBukkit end ++ + public void b() { + this.c = false; + Iterator iterator = this.f.iterator();