mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-24 03:05:49 +01:00
#2774: doImmediateRespawn not updated when switching servers
This commit is contained in:
parent
8ea25a8fc7
commit
c2cc33c6d7
@ -8,6 +8,7 @@ import net.md_5.bungee.protocol.packet.Commands;
|
||||
import net.md_5.bungee.protocol.packet.EncryptionRequest;
|
||||
import net.md_5.bungee.protocol.packet.EncryptionResponse;
|
||||
import net.md_5.bungee.protocol.packet.EntityStatus;
|
||||
import net.md_5.bungee.protocol.packet.GameState;
|
||||
import net.md_5.bungee.protocol.packet.Handshake;
|
||||
import net.md_5.bungee.protocol.packet.KeepAlive;
|
||||
import net.md_5.bungee.protocol.packet.Kick;
|
||||
@ -173,4 +174,8 @@ public abstract class AbstractPacketHandler
|
||||
public void handle(ViewDistance viewDistance) throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
public void handle(GameState gameState) throws Exception
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import net.md_5.bungee.protocol.packet.Commands;
|
||||
import net.md_5.bungee.protocol.packet.EncryptionRequest;
|
||||
import net.md_5.bungee.protocol.packet.EncryptionResponse;
|
||||
import net.md_5.bungee.protocol.packet.EntityStatus;
|
||||
import net.md_5.bungee.protocol.packet.GameState;
|
||||
import net.md_5.bungee.protocol.packet.Handshake;
|
||||
import net.md_5.bungee.protocol.packet.KeepAlive;
|
||||
import net.md_5.bungee.protocol.packet.Kick;
|
||||
@ -202,6 +203,10 @@ public enum Protocol
|
||||
map( ProtocolConstants.MINECRAFT_1_13, 0x11 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x12 )
|
||||
);
|
||||
TO_CLIENT.registerPacket(
|
||||
GameState.class,
|
||||
map( ProtocolConstants.MINECRAFT_1_15, 0x1F )
|
||||
);
|
||||
TO_CLIENT.registerPacket(
|
||||
ViewDistance.class,
|
||||
map( ProtocolConstants.MINECRAFT_1_14, 0x41 ),
|
||||
|
@ -0,0 +1,42 @@
|
||||
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 GameState extends DefinedPacket
|
||||
{
|
||||
|
||||
public static final short IMMEDIATE_RESPAWN = 11;
|
||||
//
|
||||
private short state;
|
||||
private float value;
|
||||
|
||||
@Override
|
||||
public void read(ByteBuf buf)
|
||||
{
|
||||
state = buf.readUnsignedByte();
|
||||
value = buf.readFloat();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ByteBuf buf)
|
||||
{
|
||||
buf.writeByte( state );
|
||||
buf.writeFloat( value );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(AbstractPacketHandler handler) throws Exception
|
||||
{
|
||||
handler.handle( this );
|
||||
}
|
||||
}
|
@ -37,6 +37,7 @@ import net.md_5.bungee.protocol.Protocol;
|
||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||
import net.md_5.bungee.protocol.packet.EncryptionRequest;
|
||||
import net.md_5.bungee.protocol.packet.EntityStatus;
|
||||
import net.md_5.bungee.protocol.packet.GameState;
|
||||
import net.md_5.bungee.protocol.packet.Handshake;
|
||||
import net.md_5.bungee.protocol.packet.Kick;
|
||||
import net.md_5.bungee.protocol.packet.Login;
|
||||
@ -251,6 +252,11 @@ public class ServerConnector extends PacketHandler
|
||||
|
||||
// Update debug info from login packet
|
||||
user.unsafe().sendPacket( new EntityStatus( user.getClientEntityId(), login.isReducedDebugInfo() ? EntityStatus.DEBUG_INFO_REDUCED : EntityStatus.DEBUG_INFO_NORMAL ) );
|
||||
// And immediate respawn
|
||||
if ( user.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_15 )
|
||||
{
|
||||
user.unsafe().sendPacket( new GameState( GameState.IMMEDIATE_RESPAWN, login.isNormalRespawn() ? 0 : 1 ) );
|
||||
}
|
||||
|
||||
user.setDimensionChange( true );
|
||||
if ( login.getDimension() == user.getDimension() )
|
||||
|
Loading…
Reference in New Issue
Block a user