<commit_before>package main

import (
	"fmt"
	"io"
	"net"

	"github.com/ttaylorr/minecraft/protocol"
)

func main() {
	conn, _ := net.Listen("tcp", "0.0.0.0:25565")
	for {
		client, _ := conn.Accept()
		go handleConnection(protocol.NewConnection(client))
	}
}

func handleConnection(c *protocol.Connection) {
	for {
		p, err := c.Next()
		if err == io.EOF {
			return
		}

		fmt.Println(p)
	}
}<commit_msg>Teach server to ping the client<commit_after>package main

import (
	"io"
	"math/rand"
	"net"

	"github.com/ttaylorr/minecraft/protocol"
	"github.com/ttaylorr/minecraft/protocol/packet"
)

func main() {
	conn, _ := net.Listen("tcp", "0.0.0.0:25565")
	for {
		client, _ := conn.Accept()
		go handleConnection(protocol.NewConnection(client))
	}
}

func handleConnection(c *protocol.Connection) {
	for {
		p, err := c.Next()
		if err == io.EOF {
			return
		}

		switch t := p.(type) {
		case packet.Handshake:
			state := protocol.State(uint8(t.NextState))
			c.SetState(state)
		case packet.StatusRequest:
			resp := packet.StatusResponse{}
			resp.Status.Version.Name = "1.8.8"
			resp.Status.Version.Protocol = 47
			resp.Status.Players.Max = rand.Intn(100)
			resp.Status.Players.Online = rand.Intn(101)
			resp.Status.Description.Text = "Hello from Golang!"

			c.Write(resp)
		case packet.StatusPing:
			pong := packet.StatusPong{}
			pong.Payload = t.Payload

			c.Write(pong)
		}
	}
}
{'fraction_non_alphanumeric': 0.15974212034383956, 'fraction_numerical': 0.02148997134670487, 'mean_word_length': 3.4775641025641026, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7333756', 'n_tokens_mistral': 602, 'n_tokens_neox': 534, 'n_words': 95}