#3559: Fix serialisation of certain scoreboard packets < 1.13
This commit is contained in:
@@ -35,6 +35,7 @@ import net.md_5.bungee.netty.ChannelWrapper;
|
||||
import net.md_5.bungee.netty.HandlerBoss;
|
||||
import net.md_5.bungee.netty.PacketHandler;
|
||||
import net.md_5.bungee.protocol.DefinedPacket;
|
||||
import net.md_5.bungee.protocol.Either;
|
||||
import net.md_5.bungee.protocol.PacketWrapper;
|
||||
import net.md_5.bungee.protocol.Protocol;
|
||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||
@@ -279,7 +280,12 @@ public class ServerConnector extends PacketHandler
|
||||
Scoreboard serverScoreboard = user.getServerSentScoreboard();
|
||||
for ( Objective objective : serverScoreboard.getObjectives() )
|
||||
{
|
||||
user.unsafe().sendPacket( new ScoreboardObjective( objective.getName(), ComponentSerializer.deserialize( objective.getValue() ), ScoreboardObjective.HealthDisplay.fromString( objective.getType() ), (byte) 1 ) );
|
||||
user.unsafe().sendPacket( new ScoreboardObjective(
|
||||
objective.getName(),
|
||||
( user.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_13 ) ? Either.right( ComponentSerializer.deserialize( objective.getValue() ) ) : Either.left( objective.getValue() ),
|
||||
ScoreboardObjective.HealthDisplay.fromString( objective.getType() ),
|
||||
(byte) 1 )
|
||||
);
|
||||
}
|
||||
for ( Score score : serverScoreboard.getScores() )
|
||||
{
|
||||
|
@@ -183,7 +183,7 @@ public class DownstreamBridge extends PacketHandler
|
||||
switch ( objective.getAction() )
|
||||
{
|
||||
case 0:
|
||||
serverScoreboard.addObjective( new Objective( objective.getName(), ComponentSerializer.toString( objective.getValue() ), objective.getType().toString() ) );
|
||||
serverScoreboard.addObjective( new Objective( objective.getName(), ( objective.getValue().isLeft() ) ? objective.getValue().getLeft() : ComponentSerializer.toString( objective.getValue().getRight() ), objective.getType().toString() ) );
|
||||
break;
|
||||
case 1:
|
||||
serverScoreboard.removeObjective( objective.getName() );
|
||||
@@ -192,7 +192,7 @@ public class DownstreamBridge extends PacketHandler
|
||||
Objective oldObjective = serverScoreboard.getObjective( objective.getName() );
|
||||
if ( oldObjective != null )
|
||||
{
|
||||
oldObjective.setValue( ComponentSerializer.toString( objective.getValue() ) );
|
||||
oldObjective.setValue( ( objective.getValue().isLeft() ) ? objective.getValue().getLeft() : ComponentSerializer.toString( objective.getValue().getRight() ) );
|
||||
oldObjective.setType( objective.getType().toString() );
|
||||
}
|
||||
break;
|
||||
|
Reference in New Issue
Block a user