3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 13:00:06 +01:00
Paper/CraftBukkit-Patches/0066-BungeeCord-Support.patch

58 Zeilen
2.7 KiB
Diff

2013-12-02 22:21:46 +01:00
From 036fc7ed7cf49e6ce45b6d776fe382de2dcb5d7b Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 1 Dec 2013 18:18:41 +1100
Subject: [PATCH] BungeeCord Support
Provides support for IP forwarding via BungeeCord.
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
2013-12-01 08:40:51 +01:00
index b96e2ef..251e510 100644
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -28,6 +28,15 @@ public class HandshakeListener implements PacketHandshakingInListener {
this.b.a((IChatBaseComponent) chatcomponenttext);
} else {
this.b.a((PacketListener) (new LoginListener(this.a, this.b)));
+ // Spigot Start
+ if (org.spigotmc.SpigotConfig.bungee) {
+ String[] split = packethandshakinginsetprotocol.b.split("\00");
+ if (split.length == 2) {
+ packethandshakinginsetprotocol.b = split[0];
+ b.l = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) b.getSocketAddress()).getPort());
+ }
+ }
+ // Spigot End
((LoginListener) this.b.getPacketListener()).hostname = packethandshakinginsetprotocol.b + ":" + packethandshakinginsetprotocol.c; // CraftBukkit - set hostname
}
break;
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 8f829bb..42e6311 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -34,7 +34,7 @@ public class NetworkManager extends SimpleChannelInboundHandler {
private final Queue i = Queues.newConcurrentLinkedQueue();
private final Queue j = Queues.newConcurrentLinkedQueue();
private Channel k;
- private SocketAddress l;
+ public SocketAddress l; // Spigot
private PacketListener m;
private EnumProtocol n;
private IChatBaseComponent o;
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
2013-12-01 08:40:51 +01:00
index 3039634..ca393d0 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
2013-12-01 08:40:51 +01:00
@@ -187,4 +187,9 @@ public class SpigotConfig
commands.put( "restart", new RestartCommand( "restart" ) );
WatchdogThread.doStart( timeoutTime, restartOnCrash );
}
+
+ public static boolean bungee = true;
+ private static void bungee() {
+ bungee = getBoolean("settings.bungeecord", true);
+ }
}
--
1.8.3.2