api

package
v0.0.0-...-dfd8bf3 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	ID() string
	GetPlayer() Player
	SetPlayer(Player)
	GetReader() io.Reader
	GetWriter() io.Writer
	ReadPacket() (*protocol.Packet, error)
	WritePacket(protocol.Packet) error
	HandleConnection(Server) error
	RemoteAddr() net.Addr
	SetCipher(encode, decode cipher.Stream)
	SetCompressionThreshold(int32)
	StartKeepAlive(time.Duration)
	OnReceiveKeepAlive(int64) error
	Latency() int64
	Close() error
}

type Component

type Component interface {
	Initialize(Server) error
	Start() error
	AddClient(Client)
	RemoveClient(Client)
}

type Configuration

type Configuration struct {
	Host                 string `yaml:"host"`
	Port                 uint16 `yaml:"port"`
	OnlineMode           bool   `yaml:"online_mode"`
	MOTD                 string `yaml:"motd"`
	MaxPlayers           int    `yaml:"max_players"`
	Difficulty           string `yaml:"difficulty"`
	CompressionThreshold int32  `yaml:"compression_threshold"`
	Seed                 string `yaml:"seed"`
	Hardcore             bool   `yaml:"hardcore"`
	DefaultGamemode      string `yaml:"default_gamemode"`
	ViewDistance         int    `yaml:"view_distance"`
	SimulationDistance   int    `yaml:"simulation_distance"`
	KeepAliveInterval    int    `yaml:"keep_alive_interval"`
	EnableQuery          bool   `yaml:"enable_query"`
	QueryHost            string `yaml:"query_host"`
	QueryPort            uint16 `yaml:"query_port"`
}

func NewConfiguration

func NewConfiguration() (*Configuration, error)

func (*Configuration) ReadFromFile

func (c *Configuration) ReadFromFile(path string) error

func (Configuration) Validate

func (c Configuration) Validate() error

func (Configuration) WriteToFile

func (c Configuration) WriteToFile(config string) error

type Handler

type Handler interface {
	PacketID() proto.VarInt
	Execute(Server, Client, proto.Packet) error
}

type Player

type Player interface {
	EntityID() int64
	Username() string
	UUID() proto.UUID
	Gamemode() enum.Gamemode
	Position() proto.AbsolutePosition
	SetPosition(proto.AbsolutePosition)
	Chunk() proto.RelativePosition
	SetSentChunk(int64, int64)
	HasSentChunk(int64, int64) bool
	Rotation() Rotation
	SetRotation(Rotation)
}

type QueryServer

type QueryServer interface {
	Initialize(Server) error
	Start(host string, port uint16) error
	Close() error
}

type Rotation

type Rotation struct {
	Yaw   float64
	Pitch float64
}

type Server

type Server interface {
	Running() bool
	Initialize() error
	Start() error
	Close() error
	GetSocket() Socket
	AcceptConnections()
	ProcessConsoleCommand(string, *chan os.Signal) error
	AddClient(Client)
	RemoveClient(Client)
	OnlinePlayers() int
	MaxPlayers() int
	SamplePlayers() []data.StatusResponseSamplePlayer
	MOTD() proto.Chat
	Favicon() (*string, error)
	NextEntityID() int64
	OnlineMode() bool
	Difficulty() enum.Difficulty
	Hardcore() bool
	DefaultGamemode() enum.Gamemode
	DefaultWorld() *world.World
	ViewDistance() int
	SimulationDistance() int
	KeepAliveInterval() time.Duration
	Players() []Player
	Clients() []Client
	Host() string
	Port() uint16
	WorldManager() *world.WorldManager
}

type Socket

type Socket interface {
	Start(string, uint16) error
	Close() error
	AcceptConnection() (Client, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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