Fix switching to servers with larger view distance
This commit is contained in:
parent
9bce83704a
commit
7d68335c1d
@ -33,6 +33,7 @@ import net.md_5.bungee.protocol.packet.TabCompleteRequest;
|
||||
import net.md_5.bungee.protocol.packet.TabCompleteResponse;
|
||||
import net.md_5.bungee.protocol.packet.Team;
|
||||
import net.md_5.bungee.protocol.packet.Title;
|
||||
import net.md_5.bungee.protocol.packet.ViewDistance;
|
||||
|
||||
public abstract class AbstractPacketHandler
|
||||
{
|
||||
@ -168,4 +169,8 @@ public abstract class AbstractPacketHandler
|
||||
public void handle(Commands commands) throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
public void handle(ViewDistance viewDistance) throws Exception
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ import net.md_5.bungee.protocol.packet.TabCompleteRequest;
|
||||
import net.md_5.bungee.protocol.packet.TabCompleteResponse;
|
||||
import net.md_5.bungee.protocol.packet.Team;
|
||||
import net.md_5.bungee.protocol.packet.Title;
|
||||
import net.md_5.bungee.protocol.packet.ViewDistance;
|
||||
|
||||
public enum Protocol
|
||||
{
|
||||
@ -184,6 +185,10 @@ public enum Protocol
|
||||
Commands.class,
|
||||
map( ProtocolConstants.MINECRAFT_1_13, 0x11 )
|
||||
);
|
||||
TO_CLIENT.registerPacket(
|
||||
ViewDistance.class,
|
||||
map( ProtocolConstants.MINECRAFT_1_14, 0x41 )
|
||||
);
|
||||
|
||||
TO_SERVER.registerPacket(
|
||||
KeepAlive.class,
|
||||
|
@ -0,0 +1,37 @@
|
||||
package net.md_5.bungee.protocol.packet;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import net.md_5.bungee.protocol.AbstractPacketHandler;
|
||||
import net.md_5.bungee.protocol.DefinedPacket;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ViewDistance extends DefinedPacket
|
||||
{
|
||||
|
||||
private int distance;
|
||||
|
||||
@Override
|
||||
public void read(ByteBuf buf)
|
||||
{
|
||||
distance = DefinedPacket.readVarInt( buf );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ByteBuf buf)
|
||||
{
|
||||
DefinedPacket.writeVarInt( distance, buf );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(AbstractPacketHandler handler) throws Exception
|
||||
{
|
||||
handler.handle( this );
|
||||
}
|
||||
}
|
@ -46,6 +46,7 @@ import net.md_5.bungee.protocol.packet.Respawn;
|
||||
import net.md_5.bungee.protocol.packet.ScoreboardObjective;
|
||||
import net.md_5.bungee.protocol.packet.ScoreboardScore;
|
||||
import net.md_5.bungee.protocol.packet.SetCompression;
|
||||
import net.md_5.bungee.protocol.packet.ViewDistance;
|
||||
import net.md_5.bungee.util.BufUtil;
|
||||
import net.md_5.bungee.util.QuietException;
|
||||
|
||||
@ -258,6 +259,10 @@ public class ServerConnector extends PacketHandler
|
||||
|
||||
user.setServerEntityId( login.getEntityId() );
|
||||
user.unsafe().sendPacket( new Respawn( login.getDimension(), login.getDifficulty(), login.getGameMode(), login.getLevelType() ) );
|
||||
if ( user.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_14 )
|
||||
{
|
||||
user.unsafe().sendPacket( new ViewDistance( login.getViewDistance() ) );
|
||||
}
|
||||
user.setDimension( login.getDimension() );
|
||||
|
||||
// Remove from old servers
|
||||
|
Loading…
Reference in New Issue
Block a user