gomine

package
v0.0.0-...-efce03c Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: GPL-3.0, GPL-3.0 Imports: 45 Imported by: 0

README










GoMine is a Minecraft Bedrock Edition server software written in Go.

Information

GoMine is a fast multi-threaded Minecraft server software. It aims to provide a highly customizable API for plugin developers to use. GoMine aims to make the setup of a server very easy, (through an executable) with low compile times, and aims to make GoMine usable for other purposes than just a vanilla server.

Current State

GoMine is currently under heavy development and is not usable for production servers yet. It lacks many features which are yet to be implemented, and has (yet unknown) bugs that should be resolved.

Releases and Development Builds

Development builds of GoMine might be unstable and should be used with care. It is always recommended to run officially released versions of GoMine for production where possible, to ensure no nasty bugs appear. If you do decide to run a development version, be aware that bugs may occur. Don't hesitate to report those bugs.

Setup

GoMine aims to make the setup of a server very easily. The setup of GoMine can be explained in a couple steps. If you want to use an official release:

  1. Download the executable for your operating system from Releases and move it to your setup directory.
  2. Execute the executable to run the server.

If you would like to use a development version:

  1. Install Go > 1.9 from the official release page.
  2. To clone the repository, execute go get github.com/BobbyShrd/gominetest.
  3. Compile GoMine by navigating into the irmine/gomine folder and executing go install.
  4. Navigate to the folder at GOBIN, and grab the executable.
  5. Move it to your setup folder and execute the executable.

Issues

Issues can be reported in the Issues tab. Please provide enough information for us to solve the problem. The more information you provide, the easier it makes it for us to fix your issue.

License

GoMine is licensed under the GNU General Public License.

Documentation

Index

Constants

View Source
const (
	ApiVersion = "0.0.1"

	OutdatedPlugin     = "plugin.Open: plugin was built with a different version of package"
	NoPluginsSupported = "plugin: not implemented"
)
View Source
const (
	GoMineName    = "GoMine"
	GoMineVersion = "0.0.1"
)

Variables

View Source
var AlreadyStarted = errors.New("server is already started")

AlreadyStarted gets returned during server startup, if the server has already been started.

Functions

func NewAnimateHandler

func NewAnimateHandler(_ *Server) *net.PacketHandler

func NewClientHandshakeHandler

func NewClientHandshakeHandler(server *Server) *net.PacketHandler

func NewCommandRequestHandler

func NewCommandRequestHandler(server *Server) *net.PacketHandler

func NewInteractHandler

func NewInteractHandler(_ *Server) *net.PacketHandler

func NewInventoryTransactionHandler

func NewInventoryTransactionHandler(_ *Server) *net.PacketHandler

func NewList

func NewList(server *Server) *commands.Command

func NewLoginHandler

func NewLoginHandler(server *Server) *net.PacketHandler

func NewMovePlayerHandler

func NewMovePlayerHandler(_ *Server) *net.PacketHandler

func NewPing

func NewPing() *commands.Command

func NewPlayerActionHandler

func NewPlayerActionHandler(_ *Server) *net.PacketHandler

func NewRequestChunkRadiusHandler

func NewRequestChunkRadiusHandler(server *Server) *net.PacketHandler

func NewResourcePackChunkRequestHandler

func NewResourcePackChunkRequestHandler(server *Server) *net.PacketHandler

func NewResourcePackClientResponseHandler

func NewResourcePackClientResponseHandler(server *Server) *net.PacketHandler

func NewStop

func NewStop(server *Server) *commands.Command

func NewTest

func NewTest(_ *Server) *commands.Command

func NewTextHandler

func NewTextHandler(server *Server) *net.PacketHandler

func VerifyLoginRequest

func VerifyLoginRequest(chains []types.Chain, _ *Server) (successful bool, authenticated bool, clientPublicKey *ecdsa.PublicKey)

Types

type IManifest

type IManifest interface {
	GetName() string
	GetDescription() string
	GetVersion() string
	GetAPIVersion() string
	GetAuthor() string
	GetOrganisation() string
}

type IPlugin

type IPlugin interface {
	GetServer() *Server
	OnEnable()

	GetName() string
	GetVersion() string
	GetAuthor() string
	GetOrganisation() string
	GetAPIVersion() string
	// contains filtered or unexported methods
}

type Manifest

type Manifest struct {
	Name         string
	Description  string
	Version      string
	APIVersion   string
	Author       string
	Organisation string
}

func (Manifest) GetAPIVersion

func (manifest Manifest) GetAPIVersion() string

GetAPIVersion returns the API Version of the manifest.

func (Manifest) GetAuthor

func (manifest Manifest) GetAuthor() string

GetAuthor returns the author of the manifest.

func (Manifest) GetDescription

func (manifest Manifest) GetDescription() string

GetDescription returns the description of the manifest.

func (Manifest) GetName

func (manifest Manifest) GetName() string

GetName returns the name of the manifest.

func (Manifest) GetOrganisation

func (manifest Manifest) GetOrganisation() string

GetOrganisation returns the author of the manifest.

func (Manifest) GetVersion

func (manifest Manifest) GetVersion() string

GetVersion returns the version of the manifest.

type PacketManager

type PacketManager struct {
	*protocol.PacketManagerBase
}

func NewPacketManager

func NewPacketManager(server *Server) *PacketManager

func (*PacketManager) GetAddEntity

func (protocol *PacketManager) GetAddEntity(entity protocol.AddEntityEntry) packets.IPacket

func (*PacketManager) GetAddPlayer

func (protocol *PacketManager) GetAddPlayer(uuid uuid.UUID, player protocol.AddPlayerEntry) packets.IPacket

func (*PacketManager) GetAnimate

func (protocol *PacketManager) GetAnimate(action int32, runtimeId uint64, float float32) packets.IPacket

func (*PacketManager) GetChunkRadiusUpdated

func (protocol *PacketManager) GetChunkRadiusUpdated(radius int32) packets.IPacket

func (*PacketManager) GetCraftingData

func (protocol *PacketManager) GetCraftingData() packets.IPacket

func (*PacketManager) GetDisconnect

func (protocol *PacketManager) GetDisconnect(message string, hideDisconnectScreen bool) packets.IPacket

func (*PacketManager) GetFullChunkData

func (protocol *PacketManager) GetFullChunkData(chunk *chunks.Chunk) packets.IPacket

func (*PacketManager) GetMoveEntity

func (protocol *PacketManager) GetMoveEntity(runtimeId uint64, position r3.Vector, rot data2.Rotation, flags byte, teleport bool) packets.IPacket

func (*PacketManager) GetMovePlayer

func (protocol *PacketManager) GetMovePlayer(runtimeId uint64, position r3.Vector, rotation data2.Rotation, mode byte, onGround bool, ridingRuntimeId uint64) packets.IPacket

func (*PacketManager) GetNetworkChunkPublisherUpdatePacket

func (protocol *PacketManager) GetNetworkChunkPublisherUpdatePacket(position blocks.Position, radius uint32) packets.IPacket

func (*PacketManager) GetPlayStatus

func (protocol *PacketManager) GetPlayStatus(status int32) packets.IPacket

func (*PacketManager) GetPlayerAction

func (protocol *PacketManager) GetPlayerAction(runtimeId uint64, action int32, position blocks.Position, face int32) packets.IPacket

func (*PacketManager) GetPlayerList

func (protocol *PacketManager) GetPlayerList(listType byte, players map[string]protocol.PlayerListEntry) packets.IPacket

func (*PacketManager) GetPlayerSkin

func (protocol *PacketManager) GetPlayerSkin(uuid2 uuid.UUID, skinId, geometryName, geometryData string, skinData, capeData []byte) packets.IPacket

func (*PacketManager) GetRemoveEntity

func (protocol *PacketManager) GetRemoveEntity(uniqueId int64) packets.IPacket

func (*PacketManager) GetResourcePackChunkData

func (protocol *PacketManager) GetResourcePackChunkData(packUUID string, chunkIndex int32, progress int64, data []byte) packets.IPacket

func (*PacketManager) GetResourcePackDataInfo

func (protocol *PacketManager) GetResourcePackDataInfo(pack packs.Pack) packets.IPacket

func (*PacketManager) GetResourcePackInfo

func (protocol *PacketManager) GetResourcePackInfo(mustAccept bool, resourcePacks *packs.Stack, behaviorPacks *packs.Stack) packets.IPacket

func (*PacketManager) GetResourcePackStack

func (protocol *PacketManager) GetResourcePackStack(mustAccept bool, resourcePacks *packs.Stack, behaviorPacks *packs.Stack) packets.IPacket

func (*PacketManager) GetServerHandshake

func (protocol *PacketManager) GetServerHandshake(encryptionJwt string) packets.IPacket

func (*PacketManager) GetSetEntityData

func (protocol *PacketManager) GetSetEntityData(runtimeId uint64, data map[uint32][]interface{}) packets.IPacket

func (*PacketManager) GetStartGame

func (protocol *PacketManager) GetStartGame(player protocol.StartGameEntry, runtimeIdsTable []byte) packets.IPacket

func (*PacketManager) GetText

func (protocol *PacketManager) GetText(text types.Text) packets.IPacket

func (*PacketManager) GetTransfer

func (protocol *PacketManager) GetTransfer(address string, port uint16) packets.IPacket

func (*PacketManager) GetUpdateAttributes

func (protocol *PacketManager) GetUpdateAttributes(runtimeId uint64, attributeMap data2.AttributeMap) packets.IPacket

func (*PacketManager) GetUpdateBlock

func (protocol *PacketManager) GetUpdateBlock(position blocks.Position, blockRuntimeId, dataLayerId uint32) packets.IPacket

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

func NewPlugin

func NewPlugin(server *Server) *Plugin

func (*Plugin) GetAPIVersion

func (plug *Plugin) GetAPIVersion() string

GetAPIVersion returns the API Version of the plugin.

func (*Plugin) GetAuthor

func (plug *Plugin) GetAuthor() string

GetAuthor returns the author of the plugin.

func (*Plugin) GetDescription

func (plug *Plugin) GetDescription() string

GetDescription returns the description of the plugin.

func (*Plugin) GetName

func (plug *Plugin) GetName() string

GetName returns the name of the plugin.

func (*Plugin) GetOrganisation

func (plug *Plugin) GetOrganisation() string

GetAuthor returns the author of the plugin.

func (*Plugin) GetServer

func (plug *Plugin) GetServer() *Server

GetServer returns the main server.

func (*Plugin) GetVersion

func (plug *Plugin) GetVersion() string

GetVersion returns the version of the plugin.

type PluginManager

type PluginManager struct {
	// contains filtered or unexported fields
}

func NewPluginManager

func NewPluginManager(server *Server) *PluginManager

func (*PluginManager) CompilePlugin

func (manager *PluginManager) CompilePlugin(filePath string) (*plugin.Plugin, error)

CompilePlugin compiles a plugin.go at the given path during runtime, and opens it. This action is extremely time consuming.

func (*PluginManager) GetPlugin

func (manager *PluginManager) GetPlugin(name string) IPlugin

GetPlugin returns a plugin with the given name, or nil if none could be found.

func (*PluginManager) GetPlugins

func (manager *PluginManager) GetPlugins() map[string]IPlugin

GetPlugins returns all plugins currently loaded on the server.

func (*PluginManager) GetServer

func (manager *PluginManager) GetServer() *Server

GetServer returns the main server.

func (*PluginManager) IsPluginLoaded

func (manager *PluginManager) IsPluginLoaded(name string) bool

IsPluginLoaded checks if a plugin with the given name is loaded.

func (*PluginManager) LoadPlugin

func (manager *PluginManager) LoadPlugin(filePath string) error

LoadPlugin loads a plugin at the given file path and returns an error if applicable.

func (*PluginManager) LoadPlugins

func (manager *PluginManager) LoadPlugins()

LoadPlugins loads all plugins in the 'extensions/plugins' folder.

func (*PluginManager) RecompilePlugin

func (manager *PluginManager) RecompilePlugin(filePath string) (*plugin.Plugin, error)

RecompilePlugin recompiles a plugin.so at the given path, provided the main source file is at the same location suffixed with .go.

func (*PluginManager) ValidateManifest

func (manager *PluginManager) ValidateManifest(manifest IManifest, path string) error

ValidateManifest validates the plugin manifest and checks for duplicated plugins.

type Server

type Server struct {
	ServerPath        string
	Config            *resources.GoMineConfig
	CommandReader     *text.CommandReader
	CommandManager    *commands.Manager
	PackManager       *packs.Manager
	PermissionManager *permissions.Manager
	LevelManager      *worlds.Manager
	SessionManager    *net.SessionManager
	NetworkAdapter    *net.NetworkAdapter
	PluginManager     *PluginManager
	QueryManager      query.Manager
	// contains filtered or unexported fields
}

func NewServer

func NewServer(serverPath string, config *resources.GoMineConfig) *Server

NewServer returns a new server with the given server path.

func (*Server) BroadcastMessage

func (server *Server) BroadcastMessage(message ...interface{})

Broadcast broadcasts a message to all players and the console in the server.

func (*Server) BroadcastMessageTo

func (server *Server) BroadcastMessageTo(receivers []*net.MinecraftSession, message ...interface{})

BroadcastMessageTo broadcasts a message to all receivers.

func (*Server) GeneratePongData

func (server *Server) GeneratePongData() string

GeneratePongData generates the GoRakLib pong data for the UnconnectedPong RakNet packet.

func (*Server) GenerateQueryResult

func (server *Server) GenerateQueryResult() query.Result

GenerateQueryResult returns the query data of the server in a byte array.

func (*Server) GetAddress

func (server *Server) GetAddress() string

GetAddress returns the IP address specified in the configuration.

func (*Server) GetAllowedViewDistance

func (server *Server) GetAllowedViewDistance(distance int32) int32

Returns the max view distance allowed by the server, if it's 0 it returns the given distance which is the distance given by a joining player

func (*Server) GetCurrentTick

func (server *Server) GetCurrentTick() int64

GetCurrentTick returns the current tick the server is on.

func (*Server) GetEngineName

func (server *Server) GetEngineName() string

GetEngineName returns 'GoMine'.

func (*Server) GetMaxViewDistance

func (server *Server) GetMaxViewDistance() int32

Returns the max view distance allowed by the server

func (*Server) GetMaximumPlayers

func (server *Server) GetMaximumPlayers() uint

GetMaximumPlayers returns the maximum amount of players on the server.

func (*Server) GetMinecraftNetworkVersion

func (server *Server) GetMinecraftNetworkVersion() string

GetMinecraftNetworkVersion returns the latest Minecraft network version. For example: "1.2.10.1"

func (*Server) GetMinecraftVersion

func (server *Server) GetMinecraftVersion() string

GetMinecraftVersion returns the latest Minecraft game version. It is prefixed with a 'v', for example: "v1.2.10.1"

func (*Server) GetMotd

func (server *Server) GetMotd() string

Returns the Message Of The Day of the server.

func (*Server) GetName

func (server *Server) GetName() string

GetName returns the LAN name of the server specified in the configuration.

func (*Server) GetPort

func (server *Server) GetPort() uint16

GetPort returns the port of the server specified in the configuration.

func (*Server) GetPrivateKey

func (server *Server) GetPrivateKey() *ecdsa.PrivateKey

GetPrivateKey returns the ECDSA private key of the server.

func (*Server) GetPublicKey

func (server *Server) GetPublicKey() *ecdsa.PublicKey

GetPublicKey returns the ECDSA public key of the private key of the server.

func (*Server) GetServerToken

func (server *Server) GetServerToken() []byte

GetServerToken returns the server token byte sequence.

func (*Server) HandleDisconnect

func (server *Server) HandleDisconnect(s *server.Session)

HandleDisconnect handles a disconnection from a session.

func (*Server) HandleRaw

func (server *Server) HandleRaw(packet []byte, addr *net2.UDPAddr)

HandleRaw handles a raw packet, for instance a query packet.

func (*Server) HasPermission

func (server *Server) HasPermission(string) bool

HasPermission returns if the server has a given permission. Always returns true to satisfy the ICommandSender interface.

func (*Server) IsRunning

func (server *Server) IsRunning() bool

IsRunning checks if the server is running.

func (*Server) RegisterDefaultCommands

func (server *Server) RegisterDefaultCommands()

RegisterDefaultCommands registers all default commands of the server.

func (*Server) SendMessage

func (server *Server) SendMessage(message ...interface{})

SendMessage sends a message to the server to satisfy the ICommandSender interface.

func (*Server) Shutdown

func (server *Server) Shutdown()

Shutdown shuts down the server, saving and disabling everything.

func (*Server) Start

func (server *Server) Start() error

Start starts the server and loads levels, plugins, resource packs etc. Start returns an error if one occurred during starting.

func (*Server) Tick

func (server *Server) Tick()

Tick ticks the entire server. (Levels, scheduler, GoRakLib server etc.) Internal. Not to be used by plugins.

Jump to

Keyboard shortcuts

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