tablist

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	OwningTabList InternalTabList

	sync.RWMutex
	EntryAttributes
}

func (*Entry) ChatSession

func (e *Entry) ChatSession() player.ChatSession

func (*Entry) DisplayName

func (e *Entry) DisplayName() component.Component

func (*Entry) GameMode

func (e *Entry) GameMode() int

func (*Entry) Latency

func (e *Entry) Latency() time.Duration

func (*Entry) Listed

func (e *Entry) Listed() bool

func (*Entry) Profile

func (e *Entry) Profile() profile.GameProfile

func (*Entry) SetChatSessionInternal

func (e *Entry) SetChatSessionInternal(chatSession player.ChatSession)

func (*Entry) SetDisplayName

func (e *Entry) SetDisplayName(name component.Component) error

func (*Entry) SetDisplayNameInternal

func (e *Entry) SetDisplayNameInternal(name component.Component)

func (*Entry) SetGameMode

func (e *Entry) SetGameMode(gameMode int) error

func (*Entry) SetGameModeInternal

func (e *Entry) SetGameModeInternal(gameMode int)

func (*Entry) SetLatency

func (e *Entry) SetLatency(latency time.Duration) error

func (*Entry) SetLatencyInternal

func (e *Entry) SetLatencyInternal(latency time.Duration)

func (*Entry) SetListed

func (e *Entry) SetListed(listed bool) error

func (*Entry) SetListedInternal

func (e *Entry) SetListedInternal(listed bool)

func (*Entry) TabList

func (e *Entry) TabList() tablist.TabList

type EntryAttributes

type EntryAttributes struct {
	Profile     profile.GameProfile
	DisplayName component.Component // nil-able
	Latency     time.Duration
	GameMode    int
	Listed      bool
	ChatSession player.ChatSession
}

type InternalTabList

type InternalTabList interface {
	tablist.TabList

	ProcessRemove(info *playerinfo.Remove)
	ProcessUpdate(info *playerinfo.Upsert) error
	ProcessLegacy(legacy *legacytablist.PlayerListItem) error

	EmitActionRaw(action playerinfo.UpsertAction, entry *playerinfo.Entry) error
	UpdateEntry(action legacytablist.PlayerListItemAction, entry tablist.Entry) error

	Parent() InternalTabList // Used to resolve the parent root struct of an embedded tab list struct
}

func New

func New(viewer Viewer) InternalTabList

New creates a new tab list for the given viewer.

func ResolveRoot

func ResolveRoot(i InternalTabList) InternalTabList

ResolveRoot returns the root structure of the tab list.

type KeyedEntry

type KeyedEntry struct {
	Entry
}

func (*KeyedEntry) SetDisplayName

func (k *KeyedEntry) SetDisplayName(name component.Component) error

func (*KeyedEntry) SetGameMode

func (k *KeyedEntry) SetGameMode(gameMode int) error

func (*KeyedEntry) SetLatency

func (k *KeyedEntry) SetLatency(latency time.Duration) error

func (*KeyedEntry) SetListed

func (k *KeyedEntry) SetListed(bool) error

type KeyedTabList

type KeyedTabList struct {
	TabList
}

func (*KeyedTabList) Add

func (k *KeyedTabList) Add(entries ...tablist.Entry) error

func (*KeyedTabList) EmitActionRaw

func (k *KeyedTabList) EmitActionRaw(action playerinfo.UpsertAction, entry *playerinfo.Entry) error

func (*KeyedTabList) ProcessLegacy

func (k *KeyedTabList) ProcessLegacy(p *legacytablist.PlayerListItem) error

func (*KeyedTabList) ProcessRemove

func (k *KeyedTabList) ProcessRemove(info *playerinfo.Remove)

func (*KeyedTabList) ProcessUpdate

func (k *KeyedTabList) ProcessUpdate(info *playerinfo.Upsert) error

func (*KeyedTabList) RemoveAll

func (k *KeyedTabList) RemoveAll(ids ...uuid.UUID) error

func (*KeyedTabList) UpdateEntry

func (k *KeyedTabList) UpdateEntry(action legacytablist.PlayerListItemAction, entry tablist.Entry) error

type LegacyEntry

type LegacyEntry struct {
	KeyedEntry
}

func (*LegacyEntry) SetDisplayName

func (e *LegacyEntry) SetDisplayName(name component.Component) error

type LegacyTabList

type LegacyTabList struct {
	KeyedTabList
	NameMapping map[string]uuid.UUID
	sync.Mutex
}

func (*LegacyTabList) Add

func (l *LegacyTabList) Add(entries ...tablist.Entry) error

func (*LegacyTabList) ProcessLegacy

func (l *LegacyTabList) ProcessLegacy(p *legacytablist.PlayerListItem) error

func (*LegacyTabList) RemoveAll

func (l *LegacyTabList) RemoveAll(ids ...uuid.UUID) error

func (*LegacyTabList) UpdateEntry

func (l *LegacyTabList) UpdateEntry(action legacytablist.PlayerListItemAction, entry tablist.Entry) error

type TabList

type TabList struct {
	ParentStruct InternalTabList
	Viewer       Viewer

	sync.RWMutex
	EntriesByID map[uuid.UUID]tablist.Entry
}

func (*TabList) Add

func (t *TabList) Add(entries ...tablist.Entry) error

func (*TabList) EmitActionRaw

func (t *TabList) EmitActionRaw(action playerinfo.UpsertAction, entry *playerinfo.Entry) error

func (*TabList) Entries

func (t *TabList) Entries() map[uuid.UUID]tablist.Entry

func (*TabList) Parent

func (t *TabList) Parent() InternalTabList

func (*TabList) ProcessLegacy

func (t *TabList) ProcessLegacy(legacy *legacytablist.PlayerListItem) error

func (*TabList) ProcessRemove

func (t *TabList) ProcessRemove(info *playerinfo.Remove)

func (*TabList) ProcessUpdate

func (t *TabList) ProcessUpdate(info *playerinfo.Upsert) error

func (*TabList) RemoveAll

func (t *TabList) RemoveAll(ids ...uuid.UUID) error

func (*TabList) UpdateEntry

func (t *TabList) UpdateEntry(action legacytablist.PlayerListItemAction, entry tablist.Entry) error

type Viewer

type Viewer interface {
	tablist.Viewer

	BufferPacket(packet proto.Packet) (err error)
	Flush() error
}

Jump to

Keyboard shortcuts

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