Skip to content

Commit

Permalink
minecraft: Added DefaultProtocol variable (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackjack200 committed Oct 4, 2022
1 parent f7fe4ae commit 603fc82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion minecraft/dial.go
Expand Up @@ -142,7 +142,7 @@ func (d Dialer) DialContext(ctx context.Context, network, address string) (conn
d.ErrorLog = log.New(os.Stderr, "", log.LstdFlags)
}
if d.Protocol == nil {
d.Protocol = proto{}
d.Protocol = DefaultProtocol
}
if d.FlushRate == 0 {
d.FlushRate = time.Second / 20
Expand Down
4 changes: 4 additions & 0 deletions minecraft/protocol.go
Expand Up @@ -41,3 +41,7 @@ func (p proto) ConvertToLatest(pk packet.Packet, _ *Conn) []packet.Packet { retu
func (p proto) ConvertFromLatest(pk packet.Packet, _ *Conn) []packet.Packet {
return []packet.Packet{pk}
}

// DefaultProtocol is the Protocol implementation using as default, In default it is current protocol, version and packet
// pool and does not convert any packets, as they are already of the right type.
var DefaultProtocol = proto{}

0 comments on commit 603fc82

Please sign in to comment.