62 lines
2.7 KiB
Diff
62 lines
2.7 KiB
Diff
|
From c918263543d5c8d18cfba4623fddeb9d5c788dc4 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 58e68da..6ba9c8c 100644
|
||
|
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
|
||
|
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||
|
@@ -127,6 +127,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||
|
this.a(MinecraftEncryption.b());
|
||
|
i.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.L());
|
||
|
|
||
|
+ if (!org.spigotmc.SpigotConfig.lateBind) {
|
||
|
try {
|
||
|
this.ai().a(inetaddress, this.L());
|
||
|
} catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
|
||
|
@@ -135,6 +136,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||
|
i.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
|
||
|
@@ -224,6 +226,16 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||
|
}
|
||
|
// CraftBukkit end
|
||
|
|
||
|
+ if (org.spigotmc.SpigotConfig.lateBind) {
|
||
|
+ try {
|
||
|
+ this.ai().a(inetaddress, this.L());
|
||
|
+ } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
|
||
|
+ i.warn("**** FAILED TO BIND TO PORT!");
|
||
|
+ i.warn("The exception was: {}", new Object[] { ioexception.toString()});
|
||
|
+ i.warn("Perhaps a server is already running on that port?");
|
||
|
+ return false;
|
||
|
+ }
|
||
|
+ }
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
||
|
index 978dd41..6ced245 100644
|
||
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
||
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
||
|
@@ -221,4 +221,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 );
|
||
|
+ }
|
||
|
}
|
||
|
--
|
||
|
1.9.1
|
||
|
|