minecraft

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const MojangAPIendpoint = "https://api.mojang.com"
View Source
const MojangSessionAPIendpoint = "https://sessionserver.mojang.com"

Variables

This section is empty.

Functions

func GetUUID

func GetUUID(username string) (string, error)

Types

type DeathMesasgeHandler

type DeathMesasgeHandler []*regexp.Regexp

func NewDeathMesasgeHandler

func NewDeathMesasgeHandler() (DeathMesasgeHandler, error)

func (DeathMesasgeHandler) Match

func (d DeathMesasgeHandler) Match(message string) bool

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler handles minecraft server process

func NewHandler

func NewHandler(settings Setting) *Handler

NewHandler makes new minecraft handler

func (*Handler) Interrupt

func (m *Handler) Interrupt()

Interrupt send keyboard interrupt to the minecraft server

func (*Handler) Kill

func (m *Handler) Kill()

Kill send kill the minecraft server immediately

func (*Handler) Pipes

func (m *Handler) Pipes() (stdin io.WriteCloser, stderr io.ReadCloser)

Pipes returns minecrafts process stdin / stderr pipes

these pipes are automatically closed when the process killed by Handler.Stop()

func (*Handler) Start

func (m *Handler) Start() (chan Message, error)

Start starts minectaft server

type Message

type Message struct {
	Type    MessageType
	Message string

	// when Message type is Join / Left, User will have Join or Left user name
	User string

	IsSecure bool
}

type MessageType

type MessageType int
const (
	MessageTypeJoin MessageType = iota
	MessageTypeLeft
	MessageTypeDeath
	MessageTypeMessage
	MessageTypeServermessage
	MessageTypeReachedTheAdvancement
	MessageTypeThreadINFO
	MessageTypeDifficultySet
	MessageTypeOther
)

type MetaData

type MetaData struct {
	Model string `json:"model"`
}

type Profile

type Profile struct {
	ID         string       `json:"id"`
	Name       string       `json:"name"`
	Properties []Properties `json:"properties"`
}

func GetProfile

func GetProfile(uuid string) (*Profile, error)

func (*Profile) UnmarshalJSON

func (p *Profile) UnmarshalJSON(b []byte) error

type Properties

type Properties struct {
	Name         string         `json:"name"`
	TextureValue TexuturesValue `json:"value"`
}

type Setting

type Setting struct {
	ThreadInfoRegExp string   `yaml:"ThreadInfoRegExp"`
	JAVA             string   `yaml:"JAVA"`
	CustomBinaryPath string   `yaml:"CustomBinaryPath"`
	ServerType       string   `yaml:"ServerType"`
	Options          []string `yaml:"Options"`
}

type Skin

type Skin struct {
	URL      string   `json:"url"`
	MetaData MetaData `json:"metadata"`
}

type Textures

type Textures struct {
	SKIN Skin `json:"SKIN"`
}

type TexuturesValue

type TexuturesValue struct {
	TimeStamp   int      `json:"timestamp"`
	ProfileID   string   `json:"profileId"`
	ProfileName string   `json:"profileName"`
	Textures    Textures `json:"textures"`
}

Jump to

Keyboard shortcuts

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