wrapper

package module
v0.0.0-...-a2f69a9 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2020 License: MIT Imports: 7 Imported by: 0

README

minecraft-wrapper

Minecraft Gopher

GoDoc

What is minecraft-wrapper?

Wrapper is a go package that wraps a Minecraft Server and interacts with it by pushing in commands and reading the server logs.

Usage

WIP

Documentation

Index

Constants

View Source
const (
	EmptyEvent   Event = "empty"
	StartedEvent       = "started"
	StoppedEvent       = "stopped"
	StartEvent         = "start"
	StopEvent          = "stop"
)
View Source
const (
	ServerOffline  = "offline"
	ServerOnline   = "online"
	ServerStarting = "starting"
	ServerStopping = "stopping"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Console

type Console interface {
	Start() error
	Kill() error
	WriteCmd(string) error
	ReadLine() (string, error)
}

type ConsoleImpl

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

func NewConsole

func NewConsole(cmd JavaExec) *ConsoleImpl

func (*ConsoleImpl) Kill

func (c *ConsoleImpl) Kill() error

func (*ConsoleImpl) ReadLine

func (c *ConsoleImpl) ReadLine() (string, error)

func (*ConsoleImpl) Start

func (c *ConsoleImpl) Start() error

func (*ConsoleImpl) WriteCmd

func (c *ConsoleImpl) WriteCmd(cmd string) error

type Event

type Event string

func LogParserFunc

func LogParserFunc(line string) Event

type JavaExec

type JavaExec interface {
	Stdout() io.ReadCloser
	Stdin() io.WriteCloser
	Start() error
	Kill() error
}

type JavaExecImpl

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

func JavaExecCmd

func JavaExecCmd(serverPath string, initialHeapSize, maxHeapSize int) *JavaExecImpl

func (*JavaExecImpl) Kill

func (j *JavaExecImpl) Kill() error

func (*JavaExecImpl) Start

func (j *JavaExecImpl) Start() error

func (*JavaExecImpl) Stdin

func (j *JavaExecImpl) Stdin() io.WriteCloser

func (*JavaExecImpl) Stdout

func (j *JavaExecImpl) Stdout() io.ReadCloser

type LogLine

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

func ParseToLogLine

func ParseToLogLine(line string) *LogLine

type LogParser

type LogParser func(string) Event

type StateChangeFunc

type StateChangeFunc func(Event, Event, *Wrapper)

type Wrapper

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

func NewDefaultWrapper

func NewDefaultWrapper(server string, initial, max int) *Wrapper

func NewWrapper

func NewWrapper(c Console, p LogParser) *Wrapper

func (*Wrapper) Kill

func (w *Wrapper) Kill() error

func (*Wrapper) RegisterStateChangeCBS

func (w *Wrapper) RegisterStateChangeCBS(cbs ...StateChangeFunc)

func (*Wrapper) Start

func (w *Wrapper) Start() error

func (*Wrapper) State

func (w *Wrapper) State() string

func (*Wrapper) Stop

func (w *Wrapper) Stop() error

Jump to

Keyboard shortcuts

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