mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 04:56:50 +01:00
acc7e2172b
sorry for messy commit,doing via tablet on ssh md_5
70 lines
3.1 KiB
Diff
70 lines
3.1 KiB
Diff
From b2de83d4a03ce77384dee36545abce21108680df Mon Sep 17 00:00:00 2001
|
|
From: md_5 <md_5@live.com.au>
|
|
Date: Sat, 23 Mar 2013 11:15:11 +1100
|
|
Subject: [PATCH] BungeeCord Support
|
|
|
|
- Allows BungeeCord to set the players real IP address very early in the login process, so that the BungeeCord proxy IP is never even seen by a plugin.
|
|
---
|
|
.../net/minecraft/server/PendingConnection.java | 13 +++++++++++++
|
|
src/main/java/org/bukkit/craftbukkit/Spigot.java | 2 ++
|
|
src/main/resources/configurations/bukkit.yml | 2 ++
|
|
3 files changed, 17 insertions(+), 0 deletions(-)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PendingConnection.java b/src/main/java/net/minecraft/server/PendingConnection.java
|
|
index fcfc3d2..3448fc5 100644
|
|
--- a/src/main/java/net/minecraft/server/PendingConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/PendingConnection.java
|
|
@@ -219,4 +219,17 @@ public class PendingConnection extends Connection {
|
|
static boolean a(PendingConnection pendingconnection, boolean flag) {
|
|
return pendingconnection.h = flag;
|
|
}
|
|
+
|
|
+ // Spigot start
|
|
+ @Override
|
|
+ public void a(Packet250CustomPayload pcp) {
|
|
+ if (pcp.tag.equals("BungeeCord") && org.bukkit.craftbukkit.Spigot.bungeeIPs.contains(getSocket().getInetAddress().getHostAddress())) {
|
|
+ com.google.common.io.ByteArrayDataInput in = com.google.common.io.ByteStreams.newDataInput(pcp.data);
|
|
+ String subTag = in.readUTF();
|
|
+ if (subTag.equals("Login")) {
|
|
+ networkManager.setSocketAddress(new java.net.InetSocketAddress(in.readUTF(), in.readInt()));
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
|
index e38f39c..49092c7 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
|
@@ -23,6 +23,7 @@ public class Spigot {
|
|
static AxisAlignedBB monsterBB = AxisAlignedBB.a(0, 0, 0, 0, 0, 0);
|
|
public static boolean tabPing = false;
|
|
private static Metrics metrics;
|
|
+ public static List<String> bungeeIPs;
|
|
|
|
public static void initialize(CraftServer server, SimpleCommandMap commandMap, YamlConfiguration configuration) {
|
|
commandMap.register("bukkit", new org.bukkit.craftbukkit.command.TicksPerSecondCommand("tps"));
|
|
@@ -60,6 +61,7 @@ public class Spigot {
|
|
}
|
|
|
|
tabPing = configuration.getBoolean("settings.tab-ping", tabPing);
|
|
+ bungeeIPs = configuration.getStringList("settings.bungee-proxies");
|
|
|
|
if (metrics == null) {
|
|
try {
|
|
diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml
|
|
index 35056d9..df8dfaa 100644
|
|
--- a/src/main/resources/configurations/bukkit.yml
|
|
+++ b/src/main/resources/configurations/bukkit.yml
|
|
@@ -35,6 +35,8 @@ settings:
|
|
timeout-time: 30
|
|
restart-on-crash: false
|
|
restart-script-location: /path/to/server/start.sh
|
|
+ bungee-proxies:
|
|
+ - 127.0.0.1
|
|
world-settings:
|
|
default:
|
|
growth-chunks-per-tick: 650
|
|
--
|
|
1.7.0.4
|
|
|