3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 21:10:17 +01:00
Paper/CraftBukkit-Patches/0080-Add-Late-Bind-Option.patch

64 Zeilen
2.9 KiB
Diff

From 5c1b57a167f53ec9d75190e48fe075bf40abb3da Mon Sep 17 00:00:00 2001
2014-04-12 06:18:37 +02:00
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 74e28cc..befcdbd 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -119,6 +119,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
@@ -127,6 +128,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)));
@@ -193,6 +195,18 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
String s3 = String.format("%.3fs", new Object[] { Double.valueOf((double) i1 / 1.0E9D)});
i.info("Done (" + s3 + ")! For help, type \"help\" or \"?\"");
+
+ 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;
+ }
+ }
+
if (this.propertyManager.getBoolean("enable-query", false)) {
i.info("Starting GS4 status listener");
this.k = new RemoteStatusListener(this);
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index b3278fd..af73544 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -209,4 +209,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.8.3.2