Send the players real IP for use in Spigot servers.

This commit is contained in:
md_5 2013-03-23 11:24:37 +11:00
parent 9838a09a8c
commit 13f394b9a7

View File

@ -1,6 +1,8 @@
package net.md_5.bungee; package net.md_5.bungee;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import java.util.Queue; import java.util.Queue;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -45,6 +47,13 @@ public class ServerConnector extends PacketHandler
public void connected(Channel channel) throws Exception public void connected(Channel channel) throws Exception
{ {
this.ch = channel; this.ch = channel;
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF( "Login" );
out.writeUTF( user.getAddress().getAddress().getHostAddress() );
out.writeInt( user.getAddress().getPort() );
channel.write( new PacketFAPluginMessage( "BungeeCord", out.toByteArray() ) );
channel.write( user.handshake ); channel.write( user.handshake );
channel.write( PacketCDClientStatus.CLIENT_LOGIN ); channel.write( PacketCDClientStatus.CLIENT_LOGIN );
} }