minecraft

package
v1.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenMC

func ListenMC(addr string) (*mcnet.Listener, error)

ListenMC listens on a minecraft port

Types

type Client

type Client struct {
	*mcnet.Conn

	ProtocolVersion int32
}

Client is a minecraft protocol aware connection somewhat

func (*Client) Handshake

func (c *Client) Handshake() (nextState int32, original *pk.Packet, err error)

Handshake reads the handshake packet and returns the next state

func (*Client) SendStatus

func (c *Client) SendStatus(status *Status) error

SendStatus sends status request and ping packets to the client

type Status added in v1.3.0

type Status struct {
	Version     *StatusVersion     `json:"version"`
	Players     *StatusPlayers     `json:"players"`
	Description *StatusDescription `json:"description"`
	Favicon     string             `json:"favicon"`
}

func GetServerStatus added in v1.3.0

func GetServerStatus(addr string, port uint) (*Status, error)

GetServerStatus returns a server's status

type StatusDescription added in v1.3.0

type StatusDescription struct {
	Text string `json:"text"`
}

type StatusPlayers added in v1.3.0

type StatusPlayers struct {
	Max    int           `json:"max"`
	Online int           `json:"online"`
	Sample []interface{} `json:"sample"`
}

type StatusVersion added in v1.3.0

type StatusVersion struct {
	Name     string `json:"name"`
	Protocol int    `json:"protocol"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL