Paper/Spigot-Server-Patches/0089-Configurable-RCON-IP-address.patch

60 lines
3.1 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2019-04-27 05:05:36 +02:00
From: Aikar <aikar@aikar.co>
Date: Sat, 16 Apr 2016 00:39:33 -0400
Subject: [PATCH] Configurable RCON IP address
For servers with multiple IP's, ability to bind to a specific interface.
diff --git a/src/main/java/net/minecraft/server/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/DedicatedServerProperties.java
2020-06-25 13:00:35 +02:00
index 9dcf91c0505c759d841791c37834360b82df8a7e..1122861a8f9c12668e7bd9d65e63fc9166a66d1a 100644
2019-04-27 05:05:36 +02:00
--- a/src/main/java/net/minecraft/server/DedicatedServerProperties.java
+++ b/src/main/java/net/minecraft/server/DedicatedServerProperties.java
2020-06-25 13:00:35 +02:00
@@ -55,6 +55,8 @@ public class DedicatedServerProperties extends PropertyManager<DedicatedServerPr
2019-04-27 05:05:36 +02:00
public final PropertyManager<DedicatedServerProperties>.EditableProperty<Boolean> whiteList;
2020-06-25 13:00:35 +02:00
public final GeneratorSettings generatorSettings;
2019-04-27 05:05:36 +02:00
+ public final String rconIp; // Paper - Add rcon ip
+
// CraftBukkit start
public DedicatedServerProperties(Properties properties, OptionSet optionset) {
super(properties, optionset);
2020-06-25 13:00:35 +02:00
@@ -105,6 +107,10 @@ public class DedicatedServerProperties extends PropertyManager<DedicatedServerPr
2019-04-27 05:05:36 +02:00
this.playerIdleTimeout = this.b("player-idle-timeout", 0);
this.whiteList = this.b("white-list", false);
2020-06-25 13:00:35 +02:00
this.generatorSettings = GeneratorSettings.a(properties);
2019-04-27 05:05:36 +02:00
+ // Paper start - Configurable rcon ip
+ final String rconIp = this.getSettingIfExists("rcon.ip");
+ this.rconIp = rconIp == null ? this.serverIp : rconIp;
+ // Paper end
}
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/PropertyManager.java b/src/main/java/net/minecraft/server/PropertyManager.java
index d7e81a6d99fcbf1d71f8c1f42b5138244000f584..729455ce53944a9afaaa3e30052ab44f2a87cad9 100644
2019-04-27 05:05:36 +02:00
--- a/src/main/java/net/minecraft/server/PropertyManager.java
+++ b/src/main/java/net/minecraft/server/PropertyManager.java
@@ -127,8 +127,8 @@ public abstract class PropertyManager<T extends PropertyManager<T>> {
};
}
- @Nullable
- private String c(String s) {
+ @Nullable String getSettingIfExists(final String path) { return this.c(path); } // Paper - OBFHELPER
+ @Nullable private String c(String s) { // Paper - OBFHELPER
return (String) getOverride(s, this.properties.getProperty(s)); // CraftBukkit
}
diff --git a/src/main/java/net/minecraft/server/RemoteControlListener.java b/src/main/java/net/minecraft/server/RemoteControlListener.java
2020-06-25 13:00:35 +02:00
index 064c4b24e268112770245de806217e84051dc4ff..5aea8b8c2c39bd747ecba2cdd0f6a57565c336f9 100644
2019-04-27 05:05:36 +02:00
--- a/src/main/java/net/minecraft/server/RemoteControlListener.java
+++ b/src/main/java/net/minecraft/server/RemoteControlListener.java
2020-06-25 13:00:35 +02:00
@@ -28,7 +28,7 @@ public class RemoteControlListener extends RemoteConnectionThread {
2019-04-27 05:05:36 +02:00
2020-06-25 13:00:35 +02:00
this.e = dedicatedserverproperties.rconPort;
this.h = dedicatedserverproperties.rconPassword;
- this.f = iminecraftserver.h_();
+ this.f = dedicatedserverproperties.rconIp; // Paper - Configurable rcon ip
if (this.f.isEmpty()) {
this.f = "0.0.0.0";
2019-04-27 05:05:36 +02:00
}