server

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: 24 Imported by: 0

Documentation

Overview

Package server implements minero's server behavior.

Index

Constants

View Source
const (
	ReasonPiratedGame     = "Failed to login: User not premium."
	ReasonPiratedGameLong = "" /* 126-byte string literal not displayed */
)

Variables

Packet Id is only read for "Client -> Server" packets

Functions

func ConfigCreate

func ConfigCreate() *config.Config

func ConfigDefault

func ConfigDefault() config.Map

ConfigDefault

func Handle00

func Handle00(server *Server, sender *player.Player)

Handle00 handles incoming requests of packet 0x00: KeepAlive

func Handle02

func Handle02(server *Server, sender *player.Player)

Handle02 handles incoming requests of packet 0x02: Handshake

func Handle03

func Handle03(server *Server, sender *player.Player)

Handle03 handles incoming requests of packet 0x03: ChatMessage

func Handle07

func Handle07(server *Server, sender *player.Player)

Handle07 handles incoming requests of packet 0x07: EntityInteract

func Handle0A

func Handle0A(server *Server, sender *player.Player)

Handle0A handles incoming requests of packet 0x0A: Player

func Handle0B

func Handle0B(server *Server, sender *player.Player)

Handle0B handles incoming requests of packet 0x0B: PlayerPos

func Handle0C

func Handle0C(server *Server, sender *player.Player)

Handle0C handles incoming requests of packet 0x0C: PlayerLook

func Handle0D

func Handle0D(server *Server, sender *player.Player)

Handle0D handles incoming requests of packet 0x0D: PlayerPosLook

func Handle0E

func Handle0E(server *Server, sender *player.Player)

Handle0E handles incoming requests of packet 0x0E: PlayerAction

func Handle0F

func Handle0F(server *Server, sender *player.Player)

Handle0F handles incoming requests of packet 0x0F: PlayerBlockPlace

func Handle10

func Handle10(server *Server, sender *player.Player)

Handle10 handles incoming requests of packet 0x10: ItemHeldChange

func Handle12

func Handle12(server *Server, sender *player.Player)

Handle12 handles incoming requests of packet 0x12: Animation

func Handle13

func Handle13(server *Server, sender *player.Player)

Handle13 handles incoming requests of packet 0x13: EntityAction

func Handle65

func Handle65(server *Server, sender *player.Player)

Handle65 handles incoming requests of packet 0x65: WindowClose

func Handle66

func Handle66(server *Server, sender *player.Player)

Handle66 handles incoming requests of packet 0x66: WindowClick

func Handle6A

func Handle6A(server *Server, sender *player.Player)

Handle6A handles incoming requests of packet 0x6A: ConfirmTransaction

func Handle6B

func Handle6B(server *Server, sender *player.Player)

Handle6B handles incoming requests of packet 0x6B: CreativeInventoryAction

func Handle6C

func Handle6C(server *Server, sender *player.Player)

Handle6C handles incoming requests of packet 0x6C: EnchantItem

func Handle82

func Handle82(server *Server, sender *player.Player)

Handle82 handles incoming requests of packet 0x82: SignUpdate

func HandleCA

func HandleCA(server *Server, sender *player.Player)

HandleCA handles incoming requests of packet 0xCA: PlayerAbilities

func HandleCB

func HandleCB(server *Server, sender *player.Player)

HandleCB handles incoming requests of packet 0xCB: TabComplete

func HandleCC

func HandleCC(server *Server, sender *player.Player)

HandleCC handles incoming requests of packet 0xCC: ClientSettings

func HandleCD

func HandleCD(server *Server, sender *player.Player)

HandleCD handles incoming requests of packet 0xCD: ClientStatuses

func HandleFA

func HandleFA(server *Server, sender *player.Player)

HandleFA handles incoming requests of packet 0xFA: PluginMessage

func HandleFC

func HandleFC(server *Server, sender *player.Player)

HandleFC handles incoming requests of packet 0xFC: EncryptionKeyResponse

func HandleFE

func HandleFE(server *Server, sender *player.Player)

HandleFE handles incoming requests of packet 0xFE: ServerListPing

func HandleFF

func HandleFF(server *Server, sender *player.Player)

HandleFF handles incoming requests of packet 0xFF: Disconnect

func VirtualChunks

func VirtualChunks(x, z, height int32) packet.Packet

Types

type HandlerFunc

type HandlerFunc func(*Server, *player.Player)

type Server

type Server struct {
	sync.Mutex

	// Message of the day. Text appears on server list.
	Motd string
	// Stop message. Text appears on server list.
	Stop string

	// Embed list handlers
	Cmds map[string]cmd.Cmder
	players.Players
	tickers.Tickers
	// contains filtered or unexported fields
}

func New

func New(c *config.Config) *Server

New initializes a new server instance and loads server.conf file if one exists, otherwise it'll create a new one.

func (*Server) CheckUser

func (s *Server) CheckUser(name string, secret []byte) bool

CheckUser check's if user is premium, only used when config var "server.online_mode" = true.

func (*Server) HandleLogin

func (s *Server) HandleLogin(sender *player.Player)

func (Server) Id

func (s Server) Id() string

Id returns server's Id.

func (*Server) Kick

func (s *Server) Kick(p *player.Player)

Kick kicks a player from the server

func (*Server) PrivateKey

func (s *Server) PrivateKey() *rsa.PrivateKey

PrivateKey returns server's private key.

func (*Server) PublicKey

func (s *Server) PublicKey() []byte

PublicKey returns the ASN.1 encoded version of server's x.509 public key.

func (*Server) Run

func (s *Server) Run()

Run starts up the server.

func (*Server) Tick

func (s *Server) Tick(t int64)

Tick updates time by one tick. Implements tick.Ticker interface.

Notes

Bugs

  • server: Add online_mode=false support.

  • NMS handle relative movements with other packet `packet.EntityRelMove` right now we just teleport to the destination.

  • Load nearby chunks

Directories

Path Synopsis
list
players
Package players implements a goroutine-safe player list.
Package players implements a goroutine-safe player list.
tickers
Package tickers implements a goroutine-safe ticker list.
Package tickers implements a goroutine-safe ticker list.
Package player implements player entities for a minero server.
Package player implements player entities for a minero server.
Package tick a basic interface to work with tick events.
Package tick a basic interface to work with tick events.

Jump to

Keyboard shortcuts

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