Skip to content

Commit

Permalink
minecraft/dial.go: Expect PlayStatus before RequestNetworkSettings. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
HashimTheArab committed Mar 16, 2023
1 parent d16b15a commit 96cf9d6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions minecraft/dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func (d Dialer) DialContext(ctx context.Context, network, address string) (conn
l, c := make(chan struct{}), make(chan struct{})
go listenConn(conn, d.ErrorLog, l, c)

conn.expect(packet.IDNetworkSettings)
conn.expect(packet.IDNetworkSettings, packet.IDPlayStatus)
if err := conn.WritePacket(&packet.RequestNetworkSettings{ClientProtocol: d.Protocol.ID()}); err != nil {
return nil, err
}
Expand All @@ -221,7 +221,7 @@ func (d Dialer) DialContext(ctx context.Context, network, address string) (conn
return nil, conn.wrap(ctx.Err(), "dial")
case <-l:
// We've received our network settings, so we can now send our login request.
conn.expect(packet.IDServerToClientHandshake, packet.IDPlayStatus)
conn.expect(packet.IDServerToClientHandshake)
if err := conn.WritePacket(&packet.Login{ConnectionRequest: request, ClientProtocol: d.Protocol.ID()}); err != nil {
return nil, err
}
Expand Down

0 comments on commit 96cf9d6

Please sign in to comment.