api

package
v0.0.0-...-d3751e6 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Config

type Config interface {
	ListenAddr() string
	Motd() string
	MaxPlayers() uint16
	SyncMaxPlayers() bool
	Authenticate() bool
}

type Context

type Context interface {
	Config() Config
	EventBus() EventBus
	SessionRegistry() SessionRegistry
}

type EventBus

type EventBus interface {
	HandleSessionOpen(EventSessionHandler)
	HandleSessionLogin(EventSessionHandler)
	HandleSessionClose(EventSessionHandler)
	HandleSessionState(EventSessionHandler)
	HandleSessionRedirect(EventSessionHandler)
	HandleSessionPacket(EventSessionHandler, PacketStage, PacketSubject, PacketDirection, ...SessionState)
}

type EventCancellable

type EventCancellable interface {
	SetCancelled(cancelled bool)
	IsCancelled() bool
}

type EventSession

type EventSession interface {
	Session() Session
}

type EventSessionClose

type EventSessionClose interface {
	EventSession
}

type EventSessionHandler

type EventSessionHandler func(EventSession)

type EventSessionLogin

type EventSessionLogin interface {
	EventSession
	EventCancellable
	SetReason(reason string)
	GetReason() string
}

type EventSessionOpen

type EventSessionOpen interface {
	EventSession
	EventCancellable
}

type EventSessionPacket

type EventSessionPacket interface {
	EventSession
	EventCancellable
	Packet() packet.Packet
	PacketSubject() PacketSubject
	PacketDirection() PacketDirection
	SetPacket(packet.Packet)
}

type EventSessionRedirect

type EventSessionRedirect interface {
	EventSession
	EventCancellable
	Init() bool
	ServerName() string
	ServerAddr() string
}

type EventSessionState

type EventSessionState interface {
	EventSession
	State() SessionState
}

type OutBridge

type OutBridge interface {
	Version() *minecraft.Version
}

type PacketDirection

type PacketDirection int
const (
	PacketDirectionRead PacketDirection = iota
	PacketDirectionWrite
	PacketDirectionMax
)

type PacketStage

type PacketStage int
const (
	PacketStagePre PacketStage = iota
	PacketStageMonitor
	PacketStageMax
)

type PacketSubject

type PacketSubject int
const (
	PacketSubjectClient PacketSubject = iota
	PacketSubjectOutBridge
	PacketSubjectMax
)

type Plugin

type Plugin interface {
	Init(context Context)
}

type Session

type Session interface {
	Conn() net.Conn
	Write(packet.Packet, PacketSubject)
	Pipeline() *packet.PacketPipeline
	Profile() (name string, uuid uuid.UUID)
	Disconnect(reason string)
	DisconnectJson(json string)
	Remote() (ip string, port string)
	RemoteOverride(ip string, port string)
	State() SessionState
	Version() *minecraft.Version
	OutBridge() OutBridge
}

type SessionRegistry

type SessionRegistry interface {
	HasName(name string) bool
	HasUuid(uuid uuid.UUID) bool
	GetByName(name string) (session Session)
	GetByUuid(uuid uuid.UUID) (session Session)
	GetAll() (sessions []Session)
	Len() int
}

type SessionState

type SessionState int
const (
	SessionStateDisconnected SessionState = iota
	SessionStateStatus
	SessionStateStatusPing
	SessionStateLogin
	SessionStateLoginEncrypt
	SessionStateInit
	SessionStateConnected
	SessionStateMax
)

Jump to

Keyboard shortcuts

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