mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-21 00:17:56 +01:00
63 lines
2.8 KiB
Diff
63 lines
2.8 KiB
Diff
From 7aeea7d6a4332b15cc56691df077db4d28303407 Mon Sep 17 00:00:00 2001
|
|
From: slide23 <me@slide.ws>
|
|
Date: Fri, 20 Dec 2013 20:15:33 -0600
|
|
Subject: [PATCH] Add Late Bind Option
|
|
|
|
Add late-bind config option to delay binding until loading is done.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
|
|
index e5c0ed9..d6a01a9 100644
|
|
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
|
|
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
|
@@ -176,6 +176,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
|
this.a(MinecraftEncryption.b());
|
|
DedicatedServer.LOGGER.info("Starting Minecraft server on " + (this.getServerIp().isEmpty() ? "*" : this.getServerIp()) + ":" + this.P());
|
|
|
|
+ if (!org.spigotmc.SpigotConfig.lateBind) {
|
|
try {
|
|
this.am().a(inetaddress, this.P());
|
|
} catch (IOException ioexception) {
|
|
@@ -184,6 +185,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
|
DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?");
|
|
return false;
|
|
}
|
|
+ }
|
|
|
|
// Spigot Start - Move DedicatedPlayerList up and bring plugin loading from CraftServer to here
|
|
// this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit
|
|
@@ -276,6 +278,17 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
|
}
|
|
// CraftBukkit end
|
|
|
|
+ if (org.spigotmc.SpigotConfig.lateBind) {
|
|
+ try {
|
|
+ this.am().a(inetaddress, this.P());
|
|
+ } catch (IOException ioexception) {
|
|
+ DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!");
|
|
+ DedicatedServer.LOGGER.warn("The exception was: {}", new Object[] { ioexception.toString()});
|
|
+ DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?");
|
|
+ return false;
|
|
+ }
|
|
+ }
|
|
+
|
|
if (false && this.aP() > 0L) { // Spigot - disable
|
|
Thread thread1 = new Thread(new ThreadWatchdog(this));
|
|
|
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
index a306266..4edc6af 100644
|
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
@@ -228,4 +228,9 @@ public class SpigotConfig
|
|
System.setProperty( "io.netty.eventLoopThreads", Integer.toString( count ) );
|
|
Bukkit.getLogger().log( Level.INFO, "Using {0} threads for Netty based IO", count );
|
|
}
|
|
+
|
|
+ public static boolean lateBind;
|
|
+ private static void lateBind() {
|
|
+ lateBind = getBoolean( "settings.late-bind", false );
|
|
+ }
|
|
}
|
|
--
|
|
2.5.0
|
|
|