Implement a way to get the users real IP.

This commit is contained in:
md_5 2013-01-26 16:53:33 +11:00
parent 7444fca999
commit f7d1c168fc

View File

@ -1,7 +1,9 @@
package net.md_5.bungee; package net.md_5.bungee;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
@ -413,6 +415,15 @@ public class UserConnection extends GenericConnection implements ProxiedPlayer
break outer; break outer;
} }
break; 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;
} }
} }
} }