Update packets for MINECRAFT_14_11_a
This commit is contained in:
parent
1a1a51b38d
commit
3715756be7
@ -16,7 +16,7 @@ public class Team
|
||||
private String displayName;
|
||||
private String prefix;
|
||||
private String suffix;
|
||||
private boolean friendlyFire;
|
||||
private byte friendlyFire;
|
||||
private Set<String> players = new HashSet<>();
|
||||
|
||||
public Collection<String> getPlayers()
|
||||
|
@ -7,7 +7,6 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import net.md_5.bungee.protocol.AbstractPacketHandler;
|
||||
import net.md_5.bungee.protocol.Protocol;
|
||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||
|
||||
@Data
|
||||
|
@ -19,9 +19,9 @@ public class ClientSettings extends DefinedPacket
|
||||
private String locale;
|
||||
private byte viewDistance;
|
||||
private byte chatFlags;
|
||||
private boolean unknown;
|
||||
private boolean chatColours;
|
||||
private byte difficulty;
|
||||
private byte showCape;
|
||||
private byte skinParts;
|
||||
|
||||
@Override
|
||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
@ -29,12 +29,12 @@ public class ClientSettings extends DefinedPacket
|
||||
locale = readString( buf );
|
||||
viewDistance = buf.readByte();
|
||||
chatFlags = buf.readByte();
|
||||
unknown = buf.readBoolean();
|
||||
chatColours = buf.readBoolean();
|
||||
if ( protocolVersion <= ProtocolConstants.MINECRAFT_1_7_6 )
|
||||
{
|
||||
difficulty = buf.readByte();
|
||||
}
|
||||
showCape = buf.readByte();
|
||||
skinParts = buf.readByte();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -43,12 +43,12 @@ public class ClientSettings extends DefinedPacket
|
||||
writeString( locale, buf );
|
||||
buf.writeByte( viewDistance );
|
||||
buf.writeByte( chatFlags );
|
||||
buf.writeBoolean( unknown );
|
||||
buf.writeBoolean( chatColours );
|
||||
if ( protocolVersion <= ProtocolConstants.MINECRAFT_1_7_6 )
|
||||
{
|
||||
buf.writeByte( difficulty );
|
||||
}
|
||||
buf.writeByte( showCape );
|
||||
buf.writeByte( skinParts );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,6 +7,7 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import net.md_5.bungee.protocol.AbstractPacketHandler;
|
||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@ -18,15 +19,27 @@ public class KeepAlive extends DefinedPacket
|
||||
private int randomId;
|
||||
|
||||
@Override
|
||||
public void read(ByteBuf buf)
|
||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
randomId = buf.readInt();
|
||||
if ( direction == ProtocolConstants.Direction.TO_SERVER && protocolVersion >= ProtocolConstants.MINECRAFT_14_11_a )
|
||||
{
|
||||
randomId = readVarInt( buf );
|
||||
} else
|
||||
{
|
||||
randomId = buf.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ByteBuf buf)
|
||||
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
buf.writeInt( randomId );
|
||||
if ( direction == ProtocolConstants.Direction.TO_SERVER && protocolVersion >= ProtocolConstants.MINECRAFT_14_11_a )
|
||||
{
|
||||
writeVarInt( randomId, buf );
|
||||
} else
|
||||
{
|
||||
buf.writeInt( randomId );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,6 +7,7 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import net.md_5.bungee.protocol.AbstractPacketHandler;
|
||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@ -17,22 +18,34 @@ public class PlayerListItem extends DefinedPacket
|
||||
|
||||
private String username;
|
||||
private boolean online;
|
||||
private short ping;
|
||||
private int ping;
|
||||
|
||||
@Override
|
||||
public void read(ByteBuf buf)
|
||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
username = readString( buf );
|
||||
online = buf.readBoolean();
|
||||
ping = buf.readShort();
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_14_11_a )
|
||||
{
|
||||
ping = readVarInt( buf );
|
||||
} else
|
||||
{
|
||||
ping = buf.readShort();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ByteBuf buf)
|
||||
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
writeString( username, buf );
|
||||
buf.writeBoolean( online );
|
||||
buf.writeShort( ping );
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_14_11_a )
|
||||
{
|
||||
writeVarInt( ping, buf );
|
||||
} else
|
||||
{
|
||||
buf.writeShort( ping );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,6 +7,7 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import net.md_5.bungee.protocol.AbstractPacketHandler;
|
||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@ -16,26 +17,43 @@ public class ScoreboardObjective extends DefinedPacket
|
||||
{
|
||||
|
||||
private String name;
|
||||
private String text;
|
||||
private String value;
|
||||
private String type;
|
||||
/**
|
||||
* 0 to create, 1 to remove.
|
||||
* 0 to create, 1 to remove, 2 to update display text.
|
||||
*/
|
||||
private byte action;
|
||||
|
||||
@Override
|
||||
public void read(ByteBuf buf)
|
||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
name = readString( buf );
|
||||
text = readString( buf );
|
||||
if ( protocolVersion <= ProtocolConstants.MINECRAFT_1_7_6 )
|
||||
{
|
||||
value = readString( buf );
|
||||
}
|
||||
action = buf.readByte();
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_14_11_a && ( action == 0 || action == 2 ) )
|
||||
{
|
||||
value = readString( buf );
|
||||
type = readString( buf );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ByteBuf buf)
|
||||
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
writeString( name, buf );
|
||||
writeString( text, buf );
|
||||
if ( protocolVersion <= ProtocolConstants.MINECRAFT_1_7_6 )
|
||||
{
|
||||
writeString( value, buf );
|
||||
}
|
||||
buf.writeByte( action );
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_14_11_a && ( action == 0 || action == 2 ) )
|
||||
{
|
||||
writeString( value, buf );
|
||||
writeString( type, buf );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,7 +24,9 @@ public class Team extends DefinedPacket
|
||||
private String displayName;
|
||||
private String prefix;
|
||||
private String suffix;
|
||||
private boolean friendlyFire;
|
||||
private String unknown;
|
||||
private byte unknown2;
|
||||
private byte friendlyFire;
|
||||
private String[] players;
|
||||
|
||||
/**
|
||||
@ -49,7 +51,12 @@ public class Team extends DefinedPacket
|
||||
displayName = readString( buf );
|
||||
prefix = readString( buf );
|
||||
suffix = readString( buf );
|
||||
friendlyFire = buf.readBoolean();
|
||||
friendlyFire = buf.readByte();
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_14_11_a )
|
||||
{
|
||||
unknown = readString( buf );
|
||||
unknown2 = buf.readByte();
|
||||
}
|
||||
}
|
||||
if ( mode == 0 || mode == 3 || mode == 4 )
|
||||
{
|
||||
@ -72,7 +79,12 @@ public class Team extends DefinedPacket
|
||||
writeString( displayName, buf );
|
||||
writeString( prefix, buf );
|
||||
writeString( suffix, buf );
|
||||
buf.writeBoolean( friendlyFire );
|
||||
buf.writeByte( friendlyFire );
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_14_11_a )
|
||||
{
|
||||
writeString( unknown, buf );
|
||||
buf.writeByte( unknown2 );
|
||||
}
|
||||
}
|
||||
if ( mode == 0 || mode == 3 || mode == 4 )
|
||||
{
|
||||
|
@ -153,7 +153,7 @@ public class ServerConnector extends PacketHandler
|
||||
Scoreboard serverScoreboard = user.getServerSentScoreboard();
|
||||
for ( Objective objective : serverScoreboard.getObjectives() )
|
||||
{
|
||||
user.unsafe().sendPacket( new ScoreboardObjective( objective.getName(), objective.getValue(), (byte) 1 ) );
|
||||
user.unsafe().sendPacket( new ScoreboardObjective( objective.getName(), objective.getValue(), "integer", (byte) 1 ) ); // TODO:
|
||||
}
|
||||
for ( Team team : serverScoreboard.getTeams() )
|
||||
{
|
||||
|
@ -114,7 +114,7 @@ public class DownstreamBridge extends PacketHandler
|
||||
switch ( objective.getAction() )
|
||||
{
|
||||
case 0:
|
||||
serverScoreboard.addObjective( new Objective( objective.getName(), objective.getText() ) );
|
||||
serverScoreboard.addObjective( new Objective( objective.getName(), objective.getValue() ) );
|
||||
break;
|
||||
case 1:
|
||||
serverScoreboard.removeObjective( objective.getName() );
|
||||
@ -176,7 +176,7 @@ public class DownstreamBridge extends PacketHandler
|
||||
t.setDisplayName( team.getDisplayName() );
|
||||
t.setPrefix( team.getPrefix() );
|
||||
t.setSuffix( team.getSuffix() );
|
||||
t.setFriendlyFire( team.isFriendlyFire() );
|
||||
t.setFriendlyFire( team.getFriendlyFire() );
|
||||
}
|
||||
if ( team.getPlayers() != null )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user