bedrock

package
v0.0.0-...-01deb43 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package bedrock provides the tools to manage bedrock servers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DummyBackup

func DummyBackup(files []File) error

Types

type BackupOptions

type BackupOptions struct {
	// Backupper that will
	Backupper Backupper
	// CommandTimeout time to wait for the expected response.
	CommandTimeout time.Duration
	// SavePause is the delay after the save command.
	SavePause time.Duration
}

BackupOptions

type Backupper

type Backupper interface {
	Backup(files []File) error
}

type BackupperFunc

type BackupperFunc func(files []File) error

func (BackupperFunc) Backup

func (f BackupperFunc) Backup(files []File) error

BackupperFunc implements the Backupper interface.

type File

type File struct {
	Name   string
	Length int64
}

type Server

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

Server represents a Minecraft Bedrock Server instance.

func RunServer

func RunServer(command string, arg ...string) (*Server, <-chan error)

RunServer will start the Minecraft server and sets up 3 Go routines: - Read messages from the console. - Setup write queue to send messages to the console. - Wait for the server to exit and cleanup channels and goroutines.

func (*Server) Attach

func (s *Server) Attach(in io.Reader, out io.Writer) error

func (*Server) Backup

func (s *Server) Backup(ctx context.Context, opts BackupOptions) error

Backup holds, queries, call external backups runction and resumes the server. See bedrock_server_how_to.html of the bedrock server download for more information. Warning, when this returns an error it could leave the server in an unstable state.

func (*Server) SendRawCommand

func (s *Server) SendRawCommand(rawCommand string)

SendRawCommand sends the given string directly to the server console.

func (*Server) SendRawCommandWaitResponse

func (s *Server) SendRawCommandWaitResponse(
	ctx context.Context, rawCommand, response string) (output string, err error)

SendRawCommandWaitResponse sends a command and returns when the response is returned or the context is canceled. response is a regex that can match over multiple lines.

func (*Server) Stop

func (s *Server) Stop()

Stop the server gracefully.

type TarBackup

type TarBackup struct {
	Writer io.Writer
}

func (TarBackup) Backup

func (t TarBackup) Backup(files []File) error

Jump to

Keyboard shortcuts

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