game

package
v0.0.0-...-6f503ef Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2023 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const MsgExpiresTime = time.Minute * 5

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MaxPlayers                  int    `toml:"max-players"`
	ViewDistance                int32  `toml:"view-distance"`
	ListenAddress               string `toml:"listen-address"`
	MessageOfTheDay             string `toml:"motd"`
	NetworkCompressionThreshold int    `toml:"network-compression-threshold"`
	OnlineMode                  bool   `toml:"online-mode"`
	LevelName                   string `toml:"level-name"`
	EnforceSecureProfile        bool   `toml:"enforce-secure-profile"`

	ChunkLoadingLimiter       Limiter `toml:"chunk-loading-limiter"`
	PlayerChunkLoadingLimiter Limiter `toml:"player-chunk-loading-limiter"`
}

type Game

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

func NewGame

func NewGame(log *zap.Logger, config Config, pingList *server.PlayerList, serverInfo *server.PingInfo) *Game

func (*Game) AcceptPlayer

func (g *Game) AcceptPlayer(name string, id uuid.UUID, profilePubKey *user.PublicKey, properties []user.Property, protocol int32, conn *net.Conn)

AcceptPlayer will be called in an independent goroutine when new player login

type Limiter

type Limiter struct {
	Every duration `toml:"every"`
	N     int
}

func (*Limiter) Limiter

func (l *Limiter) Limiter() *rate.Limiter

Limiter convert this to *rate.Limiter

type Tag

type Tag[T ~int32 | ~int] struct {
	Name   string
	Values map[string][]T
}

func (Tag[T]) WriteTo

func (t Tag[T]) WriteTo(w io.Writer) (n int64, err error)

Jump to

Keyboard shortcuts

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