From f579645b8846ddc82a18b4ca0b8e6eb65d197765 Mon Sep 17 00:00:00 2001 From: adman Date: Fri, 31 Jul 2026 19:34:16 +0200 Subject: [PATCH] client: add StatusRawWithVersion for version-aware status pings --- mc/client/status.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mc/client/status.go b/mc/client/status.go index 914e076..cdf8cc6 100644 --- a/mc/client/status.go +++ b/mc/client/status.go @@ -40,12 +40,17 @@ func (s *StatusClient) OnPong(p *v1_21_8.StatusToClientPacketPing) (err error) { // So ignore the resource leak warning. And maybe attach a warn ignore comment. // It does not resolve SRV records. func StatusRaw(ctx context.Context, addr string) (s *StatusClient, err error) { + return StatusRawWithVersion(ctx, addr, "1.21.8") +} + +// StatusRawWithVersion is like StatusRaw but uses the given Minecraft version for the handshake. +func StatusRawWithVersion(ctx context.Context, addr, version string) (s *StatusClient, err error) { c, err := ConnectVersionLess(ctx, addr) if err != nil { return } defer c.Close() - err = c.SetVersion("1.21.8") + err = c.SetVersion(version) if err != nil { return }