playerdb

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: MIT Imports: 16 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InventoryData added in v0.10.0

type InventoryData struct {
	// Items contains all the items in the player's main inventory.
	// This excludes armor and offhand.
	Items []item.Stack
	// Boots, Leggings, Chestplate, Helmet are armor pieces that belong to the slot corresponding to the name.
	Boots      item.Stack
	Leggings   item.Stack
	Chestplate item.Stack
	Helmet     item.Stack
	// OffHand is what the player is carrying in their non-main hand, like a shield or arrows.
	OffHand item.Stack
	// MainHandSlot saves the slot in the hotbar that the player is currently switched to.
	// Should be between 0-8.
	MainHandSlot uint32
}

InventoryData is a struct that contains all data of the player inventories.

type Provider

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

Provider is a player data provider that uses a LevelDB database to store data. The data passed on will first be converted to make sure it can be marshaled into JSON. This JSON (in bytes) will then be stored in the database under a key that is the byte representation of the player's UUID.

func NewProvider

func NewProvider(path string) (*Provider, error)

NewProvider creates a new player data provider that saves and loads data using a LevelDB database.

func (*Provider) Close

func (p *Provider) Close() error

Close ...

func (*Provider) Load

func (p *Provider) Load(id uuid.UUID, world func(world.Dimension) *world.World) (player.Config, *world.World, error)

Load ...

func (*Provider) Save

func (p *Provider) Save(id uuid.UUID, d player.Config, w *world.World) error

Save ...

Jump to

Keyboard shortcuts

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