player

package
v0.0.0-...-50e9496 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2013 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Player

type Player struct {
	entity.EntityComponent
	//Parts
	entity.PositionComponent
	entity.LastPositionComponent

	Username string
	Server   Server

	ClosedChannel chan struct{}

	Handler PlayerHandler

	LockChan chan chan struct{}
	// contains filtered or unexported fields
}

A local player is a player connected directly to this server

func NewPlayer

func NewPlayer(uuid, username string, conn *protocol.Conn, server Server) *Player

func (*Player) CanCall

func (p *Player) CanCall(command string) bool

func (*Player) DespawnPackets

func (p *Player) DespawnPackets() []protocol.Packet

func (*Player) Player

func (p *Player) Player() *Player

func (*Player) QueuePacket

func (p *Player) QueuePacket(packet protocol.Packet)

Queues a packet to be sent to the player

func (*Player) Saveable

func (p *Player) Saveable() bool

func (*Player) SendMessage

func (p *Player) SendMessage(msg *message.Message)

Sends a message to the player

func (*Player) SpawnPackets

func (p *Player) SpawnPackets() []protocol.Packet

func (*Player) Start

func (p *Player) Start()

Processes incomming and outgoing packets. Blocks until the player leaves or is kicked.

type PlayerHandler

type PlayerHandler interface {
	EnterWorld(*protocol.JoinGame)
	BlockPlacement(protocol.PlayerBlockPlacement)
	BlockDig(protocol.PlayerDigging)
	Chat(string)
	Leave()
}

type Server

type Server interface {
	entity.Server
	//Returns the default world for the server
	DefaultWorld() *world.World
	//Gets the world by name, loads the world if it isn't loaded
	World(name string) *world.World
	//Sends the packet to every player on the server
	QueuePacket(packet protocol.Packet)
	//Sends the message to every player on the server
	SendMessage(msg *message.Message)
}

Contains methods that a player needs for a server

Jump to

Keyboard shortcuts

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