Fix #156 - Bukkit trying to get client settings.

This commit is contained in:
md_5 2013-03-14 20:22:26 +11:00
parent ec1de0f636
commit 5bfab582df
5 changed files with 50 additions and 0 deletions

View File

@ -56,11 +56,17 @@ public class ServerConnector extends PacketHandler
ch.write( BungeeCord.getInstance().registerChannels() );
// TODO: Race conditions with many connects
Queue<DefinedPacket> packetQueue = ( (BungeeServerInfo) target ).getPacketQueue();
while ( !packetQueue.isEmpty() )
{
ch.write( packetQueue.poll() );
}
if ( user.settings != null )
{
ch.write( user.settings );
}
synchronized ( user.getSwitchMutex() )
{

View File

@ -60,6 +60,7 @@ public final class UserConnection implements ProxiedPlayer
private final Object permMutex = new Object();
@Getter
private final Object switchMutex = new Object();
public PacketCCSettings settings;
public UserConnection(BungeeCord bungee, Channel channel, PendingConnection pendingConnection, Packet2Handshake handshake, Packet1Login forgeLogin, List<PacketFAPluginMessage> loginMessages)
{

View File

@ -11,6 +11,7 @@ import net.md_5.bungee.api.event.PlayerDisconnectEvent;
import net.md_5.bungee.api.event.PluginMessageEvent;
import net.md_5.bungee.packet.Packet0KeepAlive;
import net.md_5.bungee.packet.Packet3Chat;
import net.md_5.bungee.packet.PacketCCSettings;
import net.md_5.bungee.packet.PacketFAPluginMessage;
import net.md_5.bungee.packet.PacketHandler;
@ -80,6 +81,12 @@ public class UpstreamBridge extends PacketHandler
}
}
@Override
public void handle(PacketCCSettings settings) throws Exception
{
con.settings = settings;
}
@Override
public void handle(PacketFAPluginMessage pluginMessage) throws Exception
{

View File

@ -0,0 +1,32 @@
package net.md_5.bungee.packet;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@ToString
@EqualsAndHashCode(callSuper = false)
public class PacketCCSettings extends DefinedPacket
{
public String locale;
public byte viewDistance;
public byte chatFlags;
public byte difficulty;
public boolean showCape;
public PacketCCSettings(byte[] buf)
{
super( 0xCC, buf );
locale = readUTF();
viewDistance = readByte();
chatFlags = readByte();
difficulty = readByte();
showCape = readBoolean();
}
@Override
public void handle(PacketHandler handler) throws Exception
{
handler.handle( this );
}
}

View File

@ -48,6 +48,10 @@ public abstract class PacketHandler
{
}
public void handle(PacketCCSettings settings) throws Exception
{
}
public void handle(PacketCDClientStatus clientStatus) throws Exception
{
}