Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added minecraft.DefaultProtocol() #153

Merged
merged 5 commits into from Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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{}