mirror of
				https://hub.spigotmc.org/stash/scm/spigot/spigot.git
				synced 2025-11-01 09:09:35 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			74 lines
		
	
	
	
		
			3.3 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			74 lines
		
	
	
	
		
			3.3 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
From aaf097a40971ba23a677172d27fcba85531387b3 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
 | 
						|
old mode 100644
 | 
						|
new mode 100755
 | 
						|
index c9bb3a6..8ec6474
 | 
						|
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
 | 
						|
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
 | 
						|
@@ -119,13 +119,15 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
 | 
						|
         this.a(MinecraftEncryption.b());
 | 
						|
         h.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.J());
 | 
						|
 
 | 
						|
-        try {
 | 
						|
-            this.ag().a(inetaddress, this.J());
 | 
						|
-        } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
 | 
						|
-            h.warn("**** FAILED TO BIND TO PORT!");
 | 
						|
-            h.warn("The exception was: {}", new Object[] { ioexception.toString()});
 | 
						|
-            h.warn("Perhaps a server is already running on that port?");
 | 
						|
-            return false;
 | 
						|
+        if (!org.spigotmc.SpigotConfig.lateBind) {
 | 
						|
+            try {
 | 
						|
+                this.ag().a(inetaddress, this.J());
 | 
						|
+            } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
 | 
						|
+                h.warn("**** FAILED TO BIND TO PORT!");
 | 
						|
+                h.warn("The exception was: {}", new Object[] { ioexception.toString()});
 | 
						|
+                h.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
 | 
						|
@@ -186,6 +188,18 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
 | 
						|
         String s3 = String.format("%.3fs", new Object[] { Double.valueOf((double) i1 / 1.0E9D)});
 | 
						|
 
 | 
						|
         h.info("Done (" + s3 + ")! For help, type \"help\" or \"?\"");
 | 
						|
+
 | 
						|
+        if (org.spigotmc.SpigotConfig.lateBind) {
 | 
						|
+            try {
 | 
						|
+                this.ag().a(inetaddress, this.J());
 | 
						|
+            } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
 | 
						|
+                h.warn("**** FAILED TO BIND TO PORT!");
 | 
						|
+                h.warn("The exception was: {}", new Object[] { ioexception.toString()});
 | 
						|
+                h.warn("Perhaps a server is already running on that port?");
 | 
						|
+                return false;
 | 
						|
+            }
 | 
						|
+        }
 | 
						|
+
 | 
						|
         if (this.propertyManager.getBoolean("enable-query", false)) {
 | 
						|
             h.info("Starting GS4 status listener");
 | 
						|
             this.j = new RemoteStatusListener(this);
 | 
						|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
 | 
						|
old mode 100644
 | 
						|
new mode 100755
 | 
						|
index 1befcb9..b25395f
 | 
						|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
 | 
						|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
 | 
						|
@@ -219,4 +219,9 @@ public class SpigotConfig
 | 
						|
             VanillaCommandWrapper.allowedCommands.add( command );
 | 
						|
         }
 | 
						|
     }
 | 
						|
+
 | 
						|
+    public static boolean lateBind;
 | 
						|
+    private static void lateBind() {
 | 
						|
+        lateBind = getBoolean( "settings.late-bind", false );
 | 
						|
+    }
 | 
						|
 }
 | 
						|
-- 
 | 
						|
1.8.4.msysgit.0
 | 
						|
 |