@@ -100,8 +100,8 @@ func NewConnHandler(s *config.ConfigProxyService,
100100 motdLen := len (motd )
101101
102102 buffer .Reset (mcprotocol .MaxVarIntLen )
103- buffer .WriteByte (0x00 ) // Client bound : Status Response
104- mcprotocol .VarInt (motdLen ).WriteTo (buffer )
103+ common . Must0 ( buffer .WriteByte (0x00 ) ) // Client bound : Status Response
104+ common . Must ( mcprotocol .VarInt (motdLen ).WriteTo (buffer ) )
105105 mcprotocol .AppendPacketLength (buffer , buffer .Len ()+ motdLen )
106106
107107 _ , err = c .Write (buffer .Bytes ())
@@ -159,9 +159,7 @@ func NewConnHandler(s *config.ConfigProxyService,
159159 if err != nil {
160160 return nil , err
161161 }
162- var (
163- playerName string
164- )
162+ var playerName string
165163 err = mcprotocol .Scan (buffer , & packetID , & playerName )
166164 if err != nil {
167165 return nil , err
@@ -176,8 +174,8 @@ func NewConnHandler(s *config.ConfigProxyService,
176174 msgLen := len (msg )
177175
178176 buffer .Reset (mcprotocol .MaxVarIntLen )
179- buffer .WriteByte (0x00 ) // Client bound : Disconnect (login)
180- mcprotocol .VarInt (msgLen ).WriteTo (buffer )
177+ common . Must0 ( buffer .WriteByte (0x00 ) ) // Client bound : Disconnect (login)
178+ common . Must ( mcprotocol .VarInt (msgLen ).WriteTo (buffer ) )
181179 mcprotocol .AppendPacketLength (buffer , buffer .Len ()+ msgLen )
182180
183181 _ , err = c .Write (buffer .Bytes ())
@@ -227,8 +225,8 @@ func NewConnHandler(s *config.ConfigProxyService,
227225 msgLen := len (msg )
228226
229227 buffer .Reset (mcprotocol .MaxVarIntLen )
230- buffer .WriteByte (0x00 ) // Client bound : Disconnect (login)
231- mcprotocol .VarInt (msgLen ).WriteTo (buffer )
228+ common . Must0 ( buffer .WriteByte (0x00 ) ) // Client bound : Disconnect (login)
229+ common . Must ( mcprotocol .VarInt (msgLen ).WriteTo (buffer ) )
232230 mcprotocol .AppendPacketLength (buffer , buffer .Len ()+ msgLen )
233231
234232 _ , err = c .Write (buffer .Bytes ())
@@ -292,6 +290,9 @@ func NewConnHandler(s *config.ConfigProxyService,
292290 byte (0x00 ),
293291 playerName ,
294292 )
293+ if err != nil {
294+ return nil , err
295+ }
295296 err = remoteMC .WritePacket (buffer )
296297 if err != nil {
297298 return nil , err
0 commit comments