UpdateLanguage.java
package com.hypixel.hytale.protocol.packets.interface_;
import com.hypixel.hytale.protocol.Packet;
import com.hypixel.hytale.protocol.io.PacketIO;
import com.hypixel.hytale.protocol.io.ProtocolException;
import com.hypixel.hytale.protocol.io.ValidationResult;
import com.hypixel.hytale.protocol.io.VarInt;
import io.netty.buffer.ByteBuf;
import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class UpdateLanguage implements Packet {
public static final int PACKET_ID = 232;
public static final boolean IS_COMPRESSED = false;
public static final int NULLABLE_BIT_FIELD_SIZE = 1;
public static final int FIXED_BLOCK_SIZE = ;
;
;
;
String language;
{
;
}
{
}
{
.language = language;
}
{
.language = other.language;
}
UpdateLanguage {
();
buf.getByte(offset);
offset + ;
((nullBits & ) != ) {
VarInt.peek(buf, pos);
(languageLen < ) {
ProtocolException.negativeLength(, languageLen);
}
(languageLen > ) {
ProtocolException.stringTooLong(, languageLen, );
}
VarInt.length(buf, pos);
obj.language = PacketIO.readVarString(buf, pos, PacketIO.UTF8);
pos + languageVarLen + languageLen;
}
obj;
}
{
buf.getByte(offset);
offset + ;
((nullBits & ) != ) {
VarInt.peek(buf, pos);
pos += VarInt.length(buf, pos) + sl;
}
pos - offset;
}
{
;
(.language != ) {
nullBits = ()(nullBits | );
}
buf.writeByte(nullBits);
(.language != ) {
PacketIO.writeVarString(buf, .language, );
}
}
{
;
(.language != ) {
size += PacketIO.stringSize(.language);
}
size;
}
ValidationResult {
(buffer.readableBytes() - offset < ) {
ValidationResult.error();
} {
buffer.getByte(offset);
offset + ;
((nullBits & ) != ) {
VarInt.peek(buffer, pos);
(languageLen < ) {
ValidationResult.error();
}
(languageLen > ) {
ValidationResult.error();
}
pos += VarInt.length(buffer, pos);
pos += languageLen;
(pos > buffer.writerIndex()) {
ValidationResult.error();
}
}
ValidationResult.OK;
}
}
UpdateLanguage {
();
copy.language = .language;
copy;
}
{
( == obj) {
;
} (obj UpdateLanguage) {
(UpdateLanguage)obj;
Objects.equals(.language, other.language);
} {
;
}
}
{
Objects.hash( []{.language});
}
}