mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 23:10:16 +01:00
Don't accept connections until all plugins have enabled
This commit is contained in:
parent
da62a66ab7
commit
06efc9ec1f
2 changed files with 47 additions and 22 deletions
|
@ -134,7 +134,7 @@
|
||||||
WorldNBTStorage worldnbtstorage = this.getConvertable().a(s, this);
|
WorldNBTStorage worldnbtstorage = this.getConvertable().a(s, this);
|
||||||
|
|
||||||
this.a(this.getWorld(), worldnbtstorage);
|
this.a(this.getWorld(), worldnbtstorage);
|
||||||
@@ -277,24 +324,134 @@
|
@@ -277,24 +324,135 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.a(worldnbtstorage.getDirectory(), worlddata);
|
this.a(worldnbtstorage.getDirectory(), worlddata);
|
||||||
|
@ -262,6 +262,7 @@
|
||||||
- WorldServer worldserver = new WorldServer(this, this.executorService, worldnbtstorage, worlddata, DimensionManager.OVERWORLD, this.methodProfiler, worldloadlistener);
|
- WorldServer worldserver = new WorldServer(this, this.executorService, worldnbtstorage, worlddata, DimensionManager.OVERWORLD, this.methodProfiler, worldloadlistener);
|
||||||
+ this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
|
+ this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
|
||||||
+ this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP));
|
+ this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP));
|
||||||
|
+ this.serverConnection.acceptConnections();
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
|
|
||||||
- this.worldServer.put(DimensionManager.OVERWORLD, worldserver);
|
- this.worldServer.put(DimensionManager.OVERWORLD, worldserver);
|
||||||
|
@ -282,7 +283,7 @@
|
||||||
|
|
||||||
if (!worlddata.u()) {
|
if (!worlddata.u()) {
|
||||||
try {
|
try {
|
||||||
@@ -318,23 +475,8 @@
|
@@ -318,23 +476,8 @@
|
||||||
|
|
||||||
worlddata.d(true);
|
worlddata.d(true);
|
||||||
}
|
}
|
||||||
|
@ -307,7 +308,7 @@
|
||||||
|
|
||||||
private void a(WorldData worlddata) {
|
private void a(WorldData worlddata) {
|
||||||
worlddata.f(false);
|
worlddata.f(false);
|
||||||
@@ -353,6 +495,23 @@
|
@@ -353,6 +496,23 @@
|
||||||
protected void a(File file, WorldData worlddata) {
|
protected void a(File file, WorldData worlddata) {
|
||||||
this.resourcePackRepository.a((ResourcePackSource) (new ResourcePackSourceVanilla()));
|
this.resourcePackRepository.a((ResourcePackSource) (new ResourcePackSourceVanilla()));
|
||||||
this.resourcePackFolder = new ResourcePackSourceFolder(new File(file, "datapacks"));
|
this.resourcePackFolder = new ResourcePackSourceFolder(new File(file, "datapacks"));
|
||||||
|
@ -331,7 +332,7 @@
|
||||||
this.resourcePackRepository.a((ResourcePackSource) this.resourcePackFolder);
|
this.resourcePackRepository.a((ResourcePackSource) this.resourcePackFolder);
|
||||||
this.resourcePackRepository.a();
|
this.resourcePackRepository.a();
|
||||||
List<ResourcePackLoader> list = Lists.newArrayList();
|
List<ResourcePackLoader> list = Lists.newArrayList();
|
||||||
@@ -373,11 +532,18 @@
|
@@ -373,11 +533,18 @@
|
||||||
this.b(worlddata);
|
this.b(worlddata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +354,7 @@
|
||||||
BlockPosition blockposition = worldserver.getSpawn();
|
BlockPosition blockposition = worldserver.getSpawn();
|
||||||
|
|
||||||
worldloadlistener.a(new ChunkCoordIntPair(blockposition));
|
worldloadlistener.a(new ChunkCoordIntPair(blockposition));
|
||||||
@@ -388,17 +554,21 @@
|
@@ -388,17 +555,21 @@
|
||||||
chunkproviderserver.addTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE);
|
chunkproviderserver.addTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE);
|
||||||
|
|
||||||
while (chunkproviderserver.b() != 441) {
|
while (chunkproviderserver.b() != 441) {
|
||||||
|
@ -384,7 +385,7 @@
|
||||||
|
|
||||||
if (forcedchunk != null) {
|
if (forcedchunk != null) {
|
||||||
WorldServer worldserver1 = this.getWorldServer(dimensionmanager);
|
WorldServer worldserver1 = this.getWorldServer(dimensionmanager);
|
||||||
@@ -413,10 +583,16 @@
|
@@ -413,10 +584,16 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,7 +404,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void a(String s, WorldNBTStorage worldnbtstorage) {
|
protected void a(String s, WorldNBTStorage worldnbtstorage) {
|
||||||
@@ -463,12 +639,16 @@
|
@@ -463,12 +640,16 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,7 +421,7 @@
|
||||||
return flag3;
|
return flag3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -477,8 +657,29 @@
|
@@ -477,8 +658,29 @@
|
||||||
this.stop();
|
this.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,7 +451,7 @@
|
||||||
if (this.getServerConnection() != null) {
|
if (this.getServerConnection() != null) {
|
||||||
this.getServerConnection().b();
|
this.getServerConnection().b();
|
||||||
}
|
}
|
||||||
@@ -487,6 +688,7 @@
|
@@ -487,6 +689,7 @@
|
||||||
MinecraftServer.LOGGER.info("Saving players");
|
MinecraftServer.LOGGER.info("Saving players");
|
||||||
this.playerList.savePlayers();
|
this.playerList.savePlayers();
|
||||||
this.playerList.shutdown();
|
this.playerList.shutdown();
|
||||||
|
@ -458,7 +459,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
MinecraftServer.LOGGER.info("Saving worlds");
|
MinecraftServer.LOGGER.info("Saving worlds");
|
||||||
@@ -556,14 +758,16 @@
|
@@ -556,14 +759,16 @@
|
||||||
while (this.isRunning) {
|
while (this.isRunning) {
|
||||||
long i = SystemUtils.getMonotonicMillis() - this.nextTick;
|
long i = SystemUtils.getMonotonicMillis() - this.nextTick;
|
||||||
|
|
||||||
|
@ -476,7 +477,7 @@
|
||||||
this.nextTick += 50L;
|
this.nextTick += 50L;
|
||||||
if (this.T) {
|
if (this.T) {
|
||||||
this.T = false;
|
this.T = false;
|
||||||
@@ -610,6 +814,12 @@
|
@@ -610,6 +815,12 @@
|
||||||
} catch (Throwable throwable1) {
|
} catch (Throwable throwable1) {
|
||||||
MinecraftServer.LOGGER.error("Exception stopping the server", throwable1);
|
MinecraftServer.LOGGER.error("Exception stopping the server", throwable1);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -489,7 +490,7 @@
|
||||||
this.exit();
|
this.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -618,8 +828,15 @@
|
@@ -618,8 +829,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canSleepForTick() {
|
private boolean canSleepForTick() {
|
||||||
|
@ -506,7 +507,7 @@
|
||||||
|
|
||||||
protected void sleepForTick() {
|
protected void sleepForTick() {
|
||||||
this.executeAll();
|
this.executeAll();
|
||||||
@@ -720,7 +937,7 @@
|
@@ -720,7 +938,7 @@
|
||||||
this.serverPing.b().a(agameprofile);
|
this.serverPing.b().a(agameprofile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,7 +516,7 @@
|
||||||
MinecraftServer.LOGGER.debug("Autosave started");
|
MinecraftServer.LOGGER.debug("Autosave started");
|
||||||
this.methodProfiler.enter("save");
|
this.methodProfiler.enter("save");
|
||||||
this.playerList.savePlayers();
|
this.playerList.savePlayers();
|
||||||
@@ -750,23 +967,40 @@
|
@@ -750,23 +968,40 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void b(BooleanSupplier booleansupplier) {
|
protected void b(BooleanSupplier booleansupplier) {
|
||||||
|
@ -557,7 +558,7 @@
|
||||||
|
|
||||||
this.methodProfiler.enter("tick");
|
this.methodProfiler.enter("tick");
|
||||||
|
|
||||||
@@ -805,7 +1039,8 @@
|
@@ -805,7 +1040,8 @@
|
||||||
this.tickables.add(runnable);
|
this.tickables.add(runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,7 +568,7 @@
|
||||||
OptionParser optionparser = new OptionParser();
|
OptionParser optionparser = new OptionParser();
|
||||||
OptionSpec<Void> optionspec = optionparser.accepts("nogui");
|
OptionSpec<Void> optionspec = optionparser.accepts("nogui");
|
||||||
OptionSpec<Void> optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits");
|
OptionSpec<Void> optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits");
|
||||||
@@ -828,15 +1063,17 @@
|
@@ -828,15 +1064,17 @@
|
||||||
optionparser.printHelpOn(System.err);
|
optionparser.printHelpOn(System.err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -587,7 +588,7 @@
|
||||||
MinecraftServer.LOGGER.info("Initialized '" + java_nio_file_path.toAbsolutePath().toString() + "' and '" + java_nio_file_path1.toAbsolutePath().toString() + "'");
|
MinecraftServer.LOGGER.info("Initialized '" + java_nio_file_path.toAbsolutePath().toString() + "' and '" + java_nio_file_path1.toAbsolutePath().toString() + "'");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -848,14 +1085,15 @@
|
@@ -848,14 +1086,15 @@
|
||||||
|
|
||||||
DispenserRegistry.init();
|
DispenserRegistry.init();
|
||||||
DispenserRegistry.c();
|
DispenserRegistry.c();
|
||||||
|
@ -606,7 +607,7 @@
|
||||||
dedicatedserver.i((String) optionset.valueOf(optionspec7));
|
dedicatedserver.i((String) optionset.valueOf(optionspec7));
|
||||||
dedicatedserver.setPort((Integer) optionset.valueOf(optionspec10));
|
dedicatedserver.setPort((Integer) optionset.valueOf(optionspec10));
|
||||||
dedicatedserver.e(optionset.has(optionspec2));
|
dedicatedserver.e(optionset.has(optionspec2));
|
||||||
@@ -878,6 +1116,29 @@
|
@@ -878,6 +1117,29 @@
|
||||||
|
|
||||||
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(MinecraftServer.LOGGER));
|
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(MinecraftServer.LOGGER));
|
||||||
Runtime.getRuntime().addShutdownHook(thread);
|
Runtime.getRuntime().addShutdownHook(thread);
|
||||||
|
@ -636,7 +637,7 @@
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception);
|
MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception);
|
||||||
}
|
}
|
||||||
@@ -897,7 +1158,9 @@
|
@@ -897,7 +1159,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startServerThread() {
|
public void startServerThread() {
|
||||||
|
@ -646,7 +647,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public File d(String s) {
|
public File d(String s) {
|
||||||
@@ -952,7 +1215,7 @@
|
@@ -952,7 +1216,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getServerModName() {
|
public String getServerModName() {
|
||||||
|
@ -655,7 +656,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public CrashReport b(CrashReport crashreport) {
|
public CrashReport b(CrashReport crashreport) {
|
||||||
@@ -991,7 +1254,7 @@
|
@@ -991,7 +1255,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean F() {
|
public boolean F() {
|
||||||
|
@ -664,7 +665,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1690,4 +1953,16 @@
|
@@ -1690,4 +1954,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
24
nms-patches/ServerConnection.patch
Normal file
24
nms-patches/ServerConnection.patch
Normal file
|
@ -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();
|
Loading…
Reference in a new issue