players

package
v0.0.0-...-93368d4 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2015 License: MIT Imports: 3 Imported by: 3

Documentation

Overview

Package players implements a goroutine-safe player list.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Players

type Players struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Players is a simple goroutine-safe player list.

func New

func New() Players

func (Players) AddPlayer

func (l Players) AddPlayer(p *player.Player)

AddPlayer adds a player to the list.

func (Players) BroadcastLogin

func (l Players) BroadcastLogin(to *player.Player)

BroadcastLogin initializes all previously online clients to a new player.

func (Players) BroadcastMessage

func (l Players) BroadcastMessage(msg string)

BroadcastMessage send a message to all online players.

func (Players) BroadcastPacket

func (l Players) BroadcastPacket(pkt packet.Packet)

BroadcastPacket sends a packet to all online players.

func (Players) Copy

func (l Players) Copy() map[string]*player.Player

Copy returns a copy of the list.

func (Players) GetPlayer

func (l Players) GetPlayer(name string) *player.Player

GetPlayer gets a player from the list by his/her name.

func (Players) Len

func (l Players) Len() int

Len returns the number of online players.

func (Players) RemPlayer

func (l Players) RemPlayer(p *player.Player)

RemPlayer removes a player from the list.

Jump to

Keyboard shortcuts

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