player

package
v0.18.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultSettings = NewSettings(&packet.ClientSettings{
	Locale:       "en_US",
	ViewDistance: 10,
	ChatColors:   true,
	SkinParts:    127,
	MainHand:     1,
})

Functions

This section is empty.

Types

type ChatMode

type ChatMode string
const (
	ShownChatMode ChatMode = "shown"
	CommandsOnly  ChatMode = "commandsOnly"
	Hidden        ChatMode = "hidden"
)

type MainHand

type MainHand string
const (
	LeftMainHand  MainHand = "left"
	RightMainHand MainHand = "right"
)

type Settings

type Settings interface {
	Locale() language.Tag // Locale of the Minecraft client.
	// ViewDistance returns the client's view distance. This does not guarantee the client will see this many
	// chunks, since your servers are responsible for sending the chunks.
	ViewDistance() uint8
	ChatMode() ChatMode   // The chat setting of the client.
	ChatColors() bool     // Whether the client has chat colors disabled.
	SkinParts() SkinParts // The parts of player skin the client will show.
	MainHand() MainHand   // The primary hand of the client.
	// ClientListing returns whether the client explicitly
	// allows listing on the TabList in anonymous tab list mode.
	//
	// This feature was introduced in 1.18.
	ClientListing() bool
}

Settings are the client settings the player gave us.

func NewSettings

func NewSettings(packet *packet.ClientSettings) Settings

type SkinParts

type SkinParts byte

func (SkinParts) Cape

func (bitmask SkinParts) Cape() bool

func (SkinParts) Hat

func (bitmask SkinParts) Hat() bool

func (SkinParts) Jacket

func (bitmask SkinParts) Jacket() bool

func (SkinParts) LeftPants

func (bitmask SkinParts) LeftPants() bool

func (SkinParts) LeftSleeve

func (bitmask SkinParts) LeftSleeve() bool

func (SkinParts) RightPants

func (bitmask SkinParts) RightPants() bool

func (SkinParts) RightSleeve

func (bitmask SkinParts) RightSleeve() bool

type TabList

type TabList interface {
	SetHeaderFooter(header, footer component.Component) error // Sets the tab list header and footer for the player.
	ClearHeaderFooter() error                                 // Clears the tab list header and footer for the player.
	AddEntry(TabListEntry) error                              // Adds an entry to the tab list.
	RemoveEntry(id uuid.UUID) error                           // Removes an entry from the tab list.
	HasEntry(id uuid.UUID) bool                               // Determines if the specified entry exists in the tab list.
	Entries() map[uuid.UUID]TabListEntry                      // Returns the entries in the tab list.
}

TabList is the tab list of a proxy.Player.

type TabListEntry

type TabListEntry interface {
	TabList() TabList // The TabList this entry is in.
	// Profile returns the profile of the entry, which uniquely identifies the entry with its
	// containing uuid, as well as deciding what is shown as the player head in the tab list.
	Profile() profile.GameProfile
	// DisplayName returns the optional text displayed for this entry in the TabList,
	// otherwise if returns nil Profile().Name is shown (but not returned here).
	DisplayName() component.Component
	// SetDisplayName the text to be displayed for the entry.
	// If nil Profile().Name will be shown.
	SetDisplayName(component.Component) error
	// GameMode returns the game mode the entry has been set to.
	//  0 - Survival
	//  1 - Creative
	//  2 - Adventure
	//  3 - Spectator
	GameMode() int
	// SetGameMode sets the gamemode for the entry.
	// See GameMode() for more details.
	SetGameMode(int) error
	// Latency returns the latency/ping for the entry.
	//
	// The icon shown in the tab list is calculated
	// by the millisecond latency as follows:
	//
	//  A negative latency will display the no connection icon
	//  0-150 will display 5 bars
	//  150-300 will display 4 bars
	//  300-600 will display 3 bars
	//  600-1000 will display 2 bars
	//  A latency move than 1 second will display 1 bar
	Latency() time.Duration
	// SetLatency sets the latency/ping for the entry.
	// See Latency() for how it is displayed.
	SetLatency(time.Duration) error
}

TabListEntry is a single entry in a TabList.

Jump to

Keyboard shortcuts

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