Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearHeaderFooter ¶ added in v0.22.0
func ClearHeaderFooter(viewer proto.PacketWriter) error
ClearHeaderFooter clears the tab list header and footer for the viewer.
func ClearTabListHeaderFooter ¶ added in v0.35.0
ClearTabListHeaderFooter clears the tab list header and footer for a tab list. Convenience function for tabList.SetHeaderFooter(nil, nil).
Types ¶
type Entry ¶
type Entry 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 greater 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
// ChatSession returns the chat session associated with this entry.
ChatSession() player.ChatSession
// Listed indicates whether the entry is listed,
// when listed they will be visible to other players in the tab list.
Listed() bool
// SetListed sets whether the entry is listed.
// Only changeable in 1.19.3 and above!
SetListed(bool) error
// ListOrder returns the order/priority of the entry in the tab list.
// Since Minecraft 1.21.2.
ListOrder() int
// SetListOrder sets the order/priority of the entry in the tab list.
// Since Minecraft 1.21.2.
SetListOrder(int) error
// ShowHat returns true if the entry shows the hat layer in the tab list.
// Since Minecraft 1.21.4.
ShowHat() bool
// SetShowHat sets whether the entry shows the hat layer in the tab list.
// Since Minecraft 1.21.4.
SetShowHat(bool) error
}
Entry is a single entry/player in a TabList.
type TabList ¶
type TabList interface {
Add(entries ...Entry) error // Adds one or more entries to the tab list.
RemoveAll(ids ...uuid.UUID) error // Removes one or more entries from the tab list. If empty removes all entries.
Entries() map[uuid.UUID]Entry // Returns the entries in the tab list.
// SetHeaderFooter sets the header and footer of the tab list.
//
// If nil is passed for either, the header/footer will be cleared.
// Use ClearTabListHeaderFooter() to clear the header and footer for convenience.
}
TabList is the tab list of a player.
type Viewer ¶ added in v0.22.0
type Viewer interface {
proto.PacketWriter
Protocol() proto.Protocol
IdentifiedKey() crypto.IdentifiedKey
}
Viewer is a tab list viewer (player).
Click to show internal directories.
Click to hide internal directories.