3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +01:00

Add missing nullability annotation

Dieser Commit ist enthalten in:
Andrew Steinborn 2021-05-14 09:28:57 -04:00
Ursprung 0af9d9d77b
Commit e65c4102a6
2 geänderte Dateien mit 8 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -42,7 +42,12 @@ public class ServerboundLoginPluginResponsePacket extends DefaultByteBufHolder i
} }
return new ServerboundLoginPluginResponsePacket(id, success, data); return new ServerboundLoginPluginResponsePacket(id, success, data);
}; };
public static final PacketWriter<ServerboundLoginPluginResponsePacket> ENCODER = PacketWriter.deprecatedEncode(); public static final PacketWriter<ServerboundLoginPluginResponsePacket> ENCODER =
(out, packet, version) -> {
ProtocolUtils.writeVarInt(out, packet.id);
out.writeBoolean(packet.success);
out.writeBytes(packet.content());
};
private final int id; private final int id;
private final boolean success; private final boolean success;
@ -53,13 +58,6 @@ public class ServerboundLoginPluginResponsePacket extends DefaultByteBufHolder i
this.success = success; this.success = success;
} }
@Override
public void encode(ByteBuf buf, ProtocolVersion version) {
ProtocolUtils.writeVarInt(buf, id);
buf.writeBoolean(success);
buf.writeBytes(content());
}
@Override @Override
public boolean handle(PacketHandler handler) { public boolean handle(PacketHandler handler) {
return handler.handle(this); return handler.handle(this);

Datei anzeigen

@ -31,6 +31,7 @@ import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.codec.CorruptedFrameException; import io.netty.handler.codec.CorruptedFrameException;
import org.checkerframework.checker.nullness.qual.Nullable;
public class MinecraftDecoder extends ChannelInboundHandlerAdapter { public class MinecraftDecoder extends ChannelInboundHandlerAdapter {
@ -96,7 +97,7 @@ public class MinecraftDecoder extends ChannelInboundHandlerAdapter {
} }
} }
private Packet readPacket(int packetId, ByteBuf buf) throws Exception { private @Nullable Packet readPacket(int packetId, ByteBuf buf) throws Exception {
PacketReader<? extends Packet> reader = this.registry.lookupReader(packetId, this.version); PacketReader<? extends Packet> reader = this.registry.lookupReader(packetId, this.version);
if (reader == null) { if (reader == null) {
return null; return null;