mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-09 04:09:54 +01:00
19972e09b8
5a0150f586ed3eb15fe6f1f596d1a5a7d806f0f9 Fix ITEM_BREAK e6a3911057bd94d8bd7021cbb4923fb84fb106d1 Upstream merge d1cdcf8d4c3639f956474f02ed662517cffbe23e Remove old patch 068df64aeee368377e1673667bffc7a6dcf90554 Rebuild all patches
63 lines
2.9 KiB
Diff
63 lines
2.9 KiB
Diff
From 352b23038a34b51f4a10872b80543e57a0a23c9a 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 240c909..ced9efa 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());
|
|
DedicatedServer.LOGGER.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.Q());
|
|
|
|
+ if (!org.spigotmc.SpigotConfig.lateBind) {
|
|
try {
|
|
this.ao().a(inetaddress, this.Q());
|
|
} catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
|
|
@@ -135,6 +136,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
|
|
@@ -225,6 +227,17 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
|
}
|
|
// CraftBukkit end
|
|
|
|
+ if (org.spigotmc.SpigotConfig.lateBind) {
|
|
+ try {
|
|
+ this.ao().a(inetaddress, this.Q());
|
|
+ } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
|
|
+ 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.aQ() > 0L) { // Spigot - disable
|
|
Thread thread = new Thread(new ThreadWatchdog(this));
|
|
|
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
index 865a17f..f3187f8 100644
|
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
@@ -227,4 +227,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.1.0
|
|
|