netherrack

package module
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: 12 Imported by: 0

README

Netherrack

A Go minecraft server

This currently builds against go tip

More infomation

Documentation

Overview

Netherrack is a minecraft server framework for Go (http://golang.org).

This is still a work in progress and there is still a lot of features that are currently missing. The api for this will mostly likely change a lot whilst i'm developing this and minecraft changes.

Index

Constants

View Source
const (
	//The currently supported protocol verison
	ProtocolVersion = protocol.Version
	//The currently supported Minecraft version
	MinecraftVersion = "1.7.2"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Ping

type Ping struct {
	Version     PingVersion     `json:"version"`
	Players     PingPlayers     `json:"players"`
	Description message.Message `json:"description"`
	Favicon     string          `json:"favicon,omitempty"`
}

Ping is json encoded before being sent to the the client. Version and Players.Online will automaticly be replaced with the correct details

type PingPlayer

type PingPlayer struct {
	Name string `json:"name"`
	Id   string `json:"id"`
}

PingPlayer is a player to be displayed on the sample player list in the minecraft client

type PingPlayers

type PingPlayers struct {
	Max    int          `json:"max"`
	Online int          `json:"online"`
	Sample []PingPlayer `json:"sample,omitempty"`
}

PingPlayers contains the number of currently online players and the max number of players. It can optionally contain a sample list of players. Online will automatically be replaced with the number of online players

type PingVersion

type PingVersion struct {
	Name     string `json:"name"`
	Protocol int    `json:"protocol"`
}

PingVersion is the version section of minecraft's server list ping

type Server

type Server struct {
	Handler ServerHandler
	// contains filtered or unexported fields
}

Server is the contains loaded worlds and handles network connections from players. The Handler must be set before use

func NewServer

func NewServer() *Server

NewServer creates a server which has its internals setup. This must be used to create a Server

func (*Server) Addr

func (server *Server) Addr() net.Addr

Addr returns the address the server is currently listening on once started.

func (*Server) DefaultWorld

func (server *Server) DefaultWorld() *world.World

DefaultWorld returns the default world for the server

func (*Server) LoadWorld

func (server *Server) LoadWorld(name string, system world.System, gen world.Generator, dimension world.Dimension) *world.World

LoadWorld gets the world by name. If the world isn't loaded but it exists then it is loaded. If it doesn't exist then it is created using the passed system.

func (*Server) QueuePacket

func (server *Server) QueuePacket(packet protocol.Packet)

QueuePacket queues the packet to be send to every player on the server

func (*Server) SendMessage

func (server *Server) SendMessage(msg *message.Message)

SendMessage sends the message to every player on the server

func (*Server) SetAuthenticator

func (server *Server) SetAuthenticator(auth protocol.Authenticator)

SetAuthenticator changes the authenticator usered by the server. This panics if the server is started.

func (*Server) SetDefaultWorld

func (server *Server) SetDefaultWorld(def string)

SetDefaultWorld sets the default world for the server. This panics if the server is started.

func (*Server) SetPing

func (server *Server) SetPing(ping Ping)

SetPing set the ping to be showed on minecraft's server browser

func (*Server) Start

func (server *Server) Start(address string) error

Start starts the minecraft server. This will block while the server is running until the server stops

func (*Server) World

func (server *Server) World(name string) *world.World

World gets the world by name. If the world isn't loaded but it exists then it is loaded.

type ServerHandler

type ServerHandler interface {
	//Called when a player joins the server (after authing).
	//Returns whether to disconnect and disconnect message
	PlayerJoin(player *player.Player) (bool, string)
}

ServerHandler handles events for the server

Directories

Path Synopsis
Package blocks contains basic infomation on minecraft blocks
Package blocks contains basic infomation on minecraft blocks
Package command provides methods to execute commands from strings Copyright 2013 Matthew Collins (purggames@gmail.com) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
Package command provides methods to execute commands from strings Copyright 2013 Matthew Collins (purggames@gmail.com) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
format
nbt
flat
Package flat is designed to replicate vanilla's superflat worlds.
Package flat is designed to replicate vanilla's superflat worlds.

Jump to

Keyboard shortcuts

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