From f7d1c168fcfbc6f458c63abeee0b52675d87481e Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 26 Jan 2013 16:53:33 +1100 Subject: [PATCH] Implement a way to get the users real IP. --- .../src/main/java/net/md_5/bungee/UserConnection.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java index aaefdc23..6915b552 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -1,7 +1,9 @@ package net.md_5.bungee; import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.DataInputStream; +import java.io.DataOutputStream; import java.io.IOException; import java.io.OutputStream; import java.net.InetSocketAddress; @@ -413,6 +415,15 @@ public class UserConnection extends GenericConnection implements ProxiedPlayer break outer; } break; + case "IP": + ByteArrayOutputStream b = new ByteArrayOutputStream(); + DataOutputStream out = new DataOutputStream(b); + out.writeUTF("IP"); + out.writeUTF(name); + out.writeUTF(getAddress().getHostString()); + out.writeInt(getAddress().getPort()); + getServer().sendData("BungeeCord", b.toByteArray()); + break; } } }