Alter BungeeCord support to require BungeeCord when it is enabled.

Dieser Commit ist enthalten in:
md_5 2014-03-15 08:46:24 +11:00
Ursprung 4adef05290
Commit 342630e7b4

Datei anzeigen

@ -1,4 +1,4 @@
From 1cc0f87c4395182a37da05723d68f1730c21a0b6 Mon Sep 17 00:00:00 2001
From 8efc549832c3ed150b6427738460301fce938ab5 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
@ -6,23 +6,26 @@ 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
index ff7b3d3..a517306 100644
index ff7b3d3..0215891 100644
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -73,6 +73,19 @@ public class HandshakeListener implements PacketHandshakingInListener {
@@ -73,6 +73,22 @@ 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 || split.length == 3) {
+ if ( split.length == 3 ) {
+ packethandshakinginsetprotocol.b = split[0];
+ b.l = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) b.getSocketAddress()).getPort());
+ }
+ if ( split.length == 3 )
+ {
+ b.spoofedUUID = split[2];
+ } else
+ {
+ chatcomponenttext = new ChatComponentText("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!");
+ this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]);
+ this.b.a(chatcomponenttext);
+ return;
+ }
+ }
+ // Spigot End