server

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 63 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadPlugins

func LoadPlugins(srv *Server)

func SetPluginDir

func SetPluginDir(dir string)

func SetServer

func SetServer(srv *Server)

func ShutdownPlugins

func ShutdownPlugins()

Types

type Allower

type Allower interface {
	Allow(addr net.Addr, d login.IdentityData, c login.ClientData) (string, bool)
}

type BanListEnum

type BanListEnum string

func (BanListEnum) Options

func (BanListEnum) Options(cmd.Source) []string

func (BanListEnum) Type

func (BanListEnum) Type() string

type BlockName

type BlockName string

func (BlockName) Options

func (BlockName) Options(cmd.Source) []string

func (BlockName) Type

func (BlockName) Type() string

type Bool

type Bool string

func (Bool) Options

func (Bool) Options(cmd.Source) []string

func (Bool) Type

func (Bool) Type() string

type CmdName

type CmdName string

func (CmdName) Options

func (CmdName) Options(src cmd.Source) []string

func (CmdName) Type

func (CmdName) Type() string

type Config

type Config struct {
	Log *slog.Logger

	Listeners []func(conf Config) (Listener, error)

	Name string

	Resources []*resource.Pack

	ResourcesRequired bool

	DisableResourceBuilding bool

	Allower Allower

	AuthDisabled bool

	BehindProxy bool

	MuteEmoteChat bool

	MaxPlayers int

	MaxChunkRadius int

	JoinMessage, QuitMessage, ShutdownMessage chat.Translation

	StatusProvider minecraft.ServerStatusProvider

	Compression packet.Compression

	PlayerProvider player.Provider

	WorldProvider world.Provider

	ReadOnlyWorld bool

	Generator func(dim world.Dimension) world.Generator

	RandomTickSpeed int

	SaveInterval time.Duration

	ChunkUnloadInterval time.Duration

	ChunkLoadWorkers int

	Entities world.EntityRegistry

	Blocks world.BlockRegistry
}

func (Config) New

func (conf Config) New() *Server

type DamageCauseEnum

type DamageCauseEnum string

func (DamageCauseEnum) Options

func (DamageCauseEnum) Options(cmd.Source) []string

func (DamageCauseEnum) Type

func (DamageCauseEnum) Type() string

type DefaultGameModeEnum

type DefaultGameModeEnum string

func (DefaultGameModeEnum) Options

func (DefaultGameModeEnum) Options(cmd.Source) []string

func (DefaultGameModeEnum) Type

func (DefaultGameModeEnum) Type() string

type DifficultyEnum

type DifficultyEnum string

func (DifficultyEnum) Options

func (DifficultyEnum) Options(cmd.Source) []string

func (DifficultyEnum) Type

func (DifficultyEnum) Type() string

type EffectEnum

type EffectEnum string

func (EffectEnum) Options

func (EffectEnum) Options(cmd.Source) []string

func (EffectEnum) Type

func (EffectEnum) Type() string

type Enchant

type Enchant string

func (Enchant) Options

func (Enchant) Options(cmd.Source) []string

func (Enchant) Type

func (Enchant) Type() string

type EntityEvent

type EntityEvent string

func (EntityEvent) Options

func (EntityEvent) Options(cmd.Source) []string

func (EntityEvent) Type

func (EntityEvent) Type() string

type GameRule

type GameRule string

func (GameRule) Options

func (GameRule) Options(cmd.Source) []string

func (GameRule) Type

func (GameRule) Type() string

type GamemodeEnum

type GamemodeEnum string

func (GamemodeEnum) Options

func (GamemodeEnum) Options(cmd.Source) []string

func (GamemodeEnum) Type

func (GamemodeEnum) Type() string

type Gma

type Gma struct{}

func (Gma) Run

func (Gma) Run(src cmd.Source, o *cmd.Output, _ *world.Tx)

type Gmc

type Gmc struct{}

func (Gmc) Run

func (Gmc) Run(src cmd.Source, o *cmd.Output, _ *world.Tx)

type Gms

type Gms struct{}

func (Gms) Run

func (Gms) Run(src cmd.Source, o *cmd.Output, _ *world.Tx)

type Gmsp

type Gmsp struct{}

func (Gmsp) Run

func (Gmsp) Run(src cmd.Source, o *cmd.Output, _ *world.Tx)

type HudElementEnum

type HudElementEnum string

func (HudElementEnum) Options

func (HudElementEnum) Options(cmd.Source) []string

func (HudElementEnum) Type

func (HudElementEnum) Type() string

type InputPermissionEnum

type InputPermissionEnum string

func (InputPermissionEnum) Options

func (InputPermissionEnum) Options(cmd.Source) []string

func (InputPermissionEnum) Type

func (InputPermissionEnum) Type() string

type ItemName

type ItemName string

func (ItemName) Options

func (ItemName) Options(cmd.Source) []string

func (ItemName) Type

func (ItemName) Type() string

type Listener

type Listener interface {
	Accept() (session.Conn, error)

	Disconnect(conn session.Conn, reason string) error
	io.Closer
}

type LocateEnum

type LocateEnum string

func (LocateEnum) Options

func (LocateEnum) Options(cmd.Source) []string

func (LocateEnum) Type

func (LocateEnum) Type() string

type MaskMode

type MaskMode string

func (MaskMode) Options

func (MaskMode) Options(cmd.Source) []string

func (MaskMode) Type

func (MaskMode) Type() string

type MobEventEnum

type MobEventEnum string

func (MobEventEnum) Options

func (MobEventEnum) Options(cmd.Source) []string

func (MobEventEnum) Type

func (MobEventEnum) Type() string

type MobName

type MobName string

func (MobName) Options

func (MobName) Options(cmd.Source) []string

func (MobName) Type

func (MobName) Type() string

type MusicAction

type MusicAction string

func (MusicAction) Options

func (MusicAction) Options(cmd.Source) []string

func (MusicAction) Type

func (MusicAction) Type() string

type OldBlockHandling

type OldBlockHandling string

func (OldBlockHandling) Options

func (OldBlockHandling) Options(cmd.Source) []string

func (OldBlockHandling) Type

func (OldBlockHandling) Type() string

type PackStackEnum

type PackStackEnum string

func (PackStackEnum) Options

func (PackStackEnum) Options(cmd.Source) []string

func (PackStackEnum) Type

func (PackStackEnum) Type() string

type ParticleType

type ParticleType string

func (ParticleType) Options

func (ParticleType) Options(cmd.Source) []string

func (ParticleType) Type

func (ParticleType) Type() string

type Permission

type Permission string

func (Permission) Options

func (Permission) Options(cmd.Source) []string

func (Permission) Type

func (Permission) Type() string

type PermissionAction

type PermissionAction string

func (PermissionAction) Options

func (PermissionAction) Options(cmd.Source) []string

func (PermissionAction) Type

func (PermissionAction) Type() string

type PermissionBoolEnum

type PermissionBoolEnum string

func (PermissionBoolEnum) Options

func (PermissionBoolEnum) Options(cmd.Source) []string

func (PermissionBoolEnum) Type

func (PermissionBoolEnum) Type() string

type Plugin

type Plugin interface {
	Meta() PluginMeta
	OnLoad(ctx PluginContext)
	OnEnable()
	OnDisable()
	OnUnload()
}

func AllPlugins

func AllPlugins() []Plugin

func LoadPlugin

func LoadPlugin(path string) (_ Plugin, loadErr error)

func PluginByName

func PluginByName(name string) (Plugin, bool)

func ReloadPlugin

func ReloadPlugin(name string, srv *Server) (_ Plugin, reloadErr error)

func UnloadPlugin

func UnloadPlugin(name string) (Plugin, bool)

type PluginContext

type PluginContext struct {
	DataFolder string
	Logger     *slog.Logger
	Server     *Server
}

type PluginMeta

type PluginMeta struct {
	Name         string
	Version      string
	Description  string
	Authors      []string
	Website      string
	Dependencies []string
}

type Server

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

func GetServer

func GetServer() *Server

func New

func New() *Server

func (*Server) Accept

func (srv *Server) Accept() iter.Seq[*player.Player]

func (*Server) AddResourcePack

func (srv *Server) AddResourcePack(pack *resource.Pack)

func (*Server) Close

func (srv *Server) Close() error

func (*Server) CloseOnProgramEnd

func (srv *Server) CloseOnProgramEnd()

func (*Server) End

func (srv *Server) End() *world.World

func (*Server) Listen

func (srv *Server) Listen()

func (*Server) MaxPlayerCount

func (srv *Server) MaxPlayerCount() int

func (*Server) Nether

func (srv *Server) Nether() *world.World

func (*Server) Player

func (srv *Server) Player(uuid uuid.UUID) (*world.EntityHandle, bool)

func (*Server) PlayerByName

func (srv *Server) PlayerByName(name string) (*world.EntityHandle, bool)

func (*Server) PlayerByXUID

func (srv *Server) PlayerByXUID(xuid string) (*world.EntityHandle, bool)

func (*Server) PlayerCount

func (srv *Server) PlayerCount() int

func (*Server) Players

func (srv *Server) Players(tx *world.Tx) iter.Seq[*player.Player]

func (*Server) RefreshPlayersCommands

func (srv *Server) RefreshPlayersCommands()

func (*Server) World

func (srv *Server) World() *world.World

type Setting

type Setting string

func (Setting) Options

func (Setting) Options(cmd.Source) []string

func (Setting) Type

func (Setting) Type() string

type SoundType

type SoundType string

func (SoundType) Options

func (SoundType) Options(cmd.Source) []string

func (SoundType) Type

func (SoundType) Type() string

type StructureRotation

type StructureRotation string

func (StructureRotation) Options

func (StructureRotation) Options(cmd.Source) []string

func (StructureRotation) Type

func (StructureRotation) Type() string

type StructureSaveMode

type StructureSaveMode string

func (StructureSaveMode) Options

func (StructureSaveMode) Options(cmd.Source) []string

func (StructureSaveMode) Type

func (StructureSaveMode) Type() string

type TimeOfDayEnum

type TimeOfDayEnum string

func (TimeOfDayEnum) Options

func (TimeOfDayEnum) Options(cmd.Source) []string

func (TimeOfDayEnum) Type

func (TimeOfDayEnum) Type() string

type TitleRawSetEnum

type TitleRawSetEnum string

func (TitleRawSetEnum) Options

func (TitleRawSetEnum) Options(cmd.Source) []string

func (TitleRawSetEnum) Type

func (TitleRawSetEnum) Type() string

type UserConfig

type UserConfig struct {
	Network struct {
		Address string
	}
	Server struct {
		Name string

		AuthEnabled bool

		DisableJoinQuitMessages bool

		MuteEmoteChat bool

		BehindProxy bool
	}
	World struct {
		SaveData bool

		Folder string
	}
	Players struct {
		MaxCount int

		MaximumChunkRadius int

		SaveData bool

		Folder string
	}
	Resources struct {
		AutoBuildPack bool

		Folder string

		Required bool
	}
}

func DefaultConfig

func DefaultConfig() UserConfig

func (UserConfig) Config

func (uc UserConfig) Config(log *slog.Logger) (Config, error)

Jump to

Keyboard shortcuts

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