Documentation ¶
Index ¶
- Constants
- Variables
- func NewAnimateHandler(_ *Server) *net.PacketHandler
- func NewClientHandshakeHandler(server *Server) *net.PacketHandler
- func NewCommandRequestHandler(server *Server) *net.PacketHandler
- func NewInteractHandler(_ *Server) *net.PacketHandler
- func NewInventoryTransactionHandler(_ *Server) *net.PacketHandler
- func NewList(server *Server) *commands.Command
- func NewLoginHandler(server *Server) *net.PacketHandler
- func NewMovePlayerHandler(_ *Server) *net.PacketHandler
- func NewPing() *commands.Command
- func NewPlayerActionHandler(_ *Server) *net.PacketHandler
- func NewRequestChunkRadiusHandler(server *Server) *net.PacketHandler
- func NewResourcePackChunkRequestHandler(server *Server) *net.PacketHandler
- func NewResourcePackClientResponseHandler(server *Server) *net.PacketHandler
- func NewStop(server *Server) *commands.Command
- func NewTest(_ *Server) *commands.Command
- func NewTextHandler(server *Server) *net.PacketHandler
- func VerifyLoginRequest(chains []types.Chain, _ *Server) (successful bool, authenticated bool, clientPublicKey *ecdsa.PublicKey)
- type IManifest
- type IPlugin
- type Manifest
- type PacketManager
- func (protocol *PacketManager) GetAddEntity(entity protocol.AddEntityEntry) packets.IPacket
- func (protocol *PacketManager) GetAddPlayer(uuid uuid.UUID, player protocol.AddPlayerEntry) packets.IPacket
- func (protocol *PacketManager) GetAnimate(action int32, runtimeId uint64, float float32) packets.IPacket
- func (protocol *PacketManager) GetChunkRadiusUpdated(radius int32) packets.IPacket
- func (protocol *PacketManager) GetCraftingData() packets.IPacket
- func (protocol *PacketManager) GetDisconnect(message string, hideDisconnectScreen bool) packets.IPacket
- func (protocol *PacketManager) GetFullChunkData(chunk *chunks.Chunk) packets.IPacket
- func (protocol *PacketManager) GetMoveEntity(runtimeId uint64, position r3.Vector, rot data2.Rotation, flags byte, ...) packets.IPacket
- func (protocol *PacketManager) GetMovePlayer(runtimeId uint64, position r3.Vector, rotation data2.Rotation, mode byte, ...) packets.IPacket
- func (protocol *PacketManager) GetNetworkChunkPublisherUpdatePacket(position blocks.Position, radius uint32) packets.IPacket
- func (protocol *PacketManager) GetPlayStatus(status int32) packets.IPacket
- func (protocol *PacketManager) GetPlayerAction(runtimeId uint64, action int32, position blocks.Position, face int32) packets.IPacket
- func (protocol *PacketManager) GetPlayerList(listType byte, players map[string]protocol.PlayerListEntry) packets.IPacket
- func (protocol *PacketManager) GetPlayerSkin(uuid2 uuid.UUID, skinId, geometryName, geometryData string, ...) packets.IPacket
- func (protocol *PacketManager) GetRemoveEntity(uniqueId int64) packets.IPacket
- func (protocol *PacketManager) GetResourcePackChunkData(packUUID string, chunkIndex int32, progress int64, data []byte) packets.IPacket
- func (protocol *PacketManager) GetResourcePackDataInfo(pack packs.Pack) packets.IPacket
- func (protocol *PacketManager) GetResourcePackInfo(mustAccept bool, resourcePacks *packs.Stack, behaviorPacks *packs.Stack) packets.IPacket
- func (protocol *PacketManager) GetResourcePackStack(mustAccept bool, resourcePacks *packs.Stack, behaviorPacks *packs.Stack) packets.IPacket
- func (protocol *PacketManager) GetServerHandshake(encryptionJwt string) packets.IPacket
- func (protocol *PacketManager) GetSetEntityData(runtimeId uint64, data map[uint32][]interface{}) packets.IPacket
- func (protocol *PacketManager) GetStartGame(player protocol.StartGameEntry, runtimeIdsTable []byte) packets.IPacket
- func (protocol *PacketManager) GetText(text types.Text) packets.IPacket
- func (protocol *PacketManager) GetTransfer(address string, port uint16) packets.IPacket
- func (protocol *PacketManager) GetUpdateAttributes(runtimeId uint64, attributeMap data2.AttributeMap) packets.IPacket
- func (protocol *PacketManager) GetUpdateBlock(position blocks.Position, blockRuntimeId, dataLayerId uint32) packets.IPacket
- type Plugin
- type PluginManager
- func (manager *PluginManager) CompilePlugin(filePath string) (*plugin.Plugin, error)
- func (manager *PluginManager) GetPlugin(name string) IPlugin
- func (manager *PluginManager) GetPlugins() map[string]IPlugin
- func (manager *PluginManager) GetServer() *Server
- func (manager *PluginManager) IsPluginLoaded(name string) bool
- func (manager *PluginManager) LoadPlugin(filePath string) error
- func (manager *PluginManager) LoadPlugins()
- func (manager *PluginManager) RecompilePlugin(filePath string) (*plugin.Plugin, error)
- func (manager *PluginManager) ValidateManifest(manifest IManifest, path string) error
- type Server
- func (server *Server) BroadcastMessage(message ...interface{})
- func (server *Server) BroadcastMessageTo(receivers []*net.MinecraftSession, message ...interface{})
- func (server *Server) GeneratePongData() string
- func (server *Server) GenerateQueryResult() query.Result
- func (server *Server) GetAddress() string
- func (server *Server) GetAllowedViewDistance(distance int32) int32
- func (server *Server) GetCurrentTick() int64
- func (server *Server) GetEngineName() string
- func (server *Server) GetMaxViewDistance() int32
- func (server *Server) GetMaximumPlayers() uint
- func (server *Server) GetMinecraftNetworkVersion() string
- func (server *Server) GetMinecraftVersion() string
- func (server *Server) GetMotd() string
- func (server *Server) GetName() string
- func (server *Server) GetPort() uint16
- func (server *Server) GetPrivateKey() *ecdsa.PrivateKey
- func (server *Server) GetPublicKey() *ecdsa.PublicKey
- func (server *Server) GetServerToken() []byte
- func (server *Server) HandleDisconnect(s *server.Session)
- func (server *Server) HandleRaw(packet []byte, addr *net2.UDPAddr)
- func (server *Server) HasPermission(string) bool
- func (server *Server) IsRunning() bool
- func (server *Server) RegisterDefaultCommands()
- func (server *Server) SendMessage(message ...interface{})
- func (server *Server) Shutdown()
- func (server *Server) Start() error
- func (server *Server) Tick()
Constants ¶
const ( ApiVersion = "0.0.1" OutdatedPlugin = "plugin.Open: plugin was built with a different version of package" NoPluginsSupported = "plugin: not implemented" )
const ( GoMineName = "GoMine" GoMineVersion = "0.0.1" )
Variables ¶
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 NewLoginHandler ¶
func NewLoginHandler(server *Server) *net.PacketHandler
func NewMovePlayerHandler ¶
func NewMovePlayerHandler(_ *Server) *net.PacketHandler
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 NewTextHandler ¶
func NewTextHandler(server *Server) *net.PacketHandler
Types ¶
type Manifest ¶
type Manifest struct { Name string Description string Version string APIVersion string Author string Organisation string }
func (Manifest) GetAPIVersion ¶
GetAPIVersion returns the API Version of the manifest.
func (Manifest) GetDescription ¶
GetDescription returns the description of the manifest.
func (Manifest) GetOrganisation ¶
GetOrganisation returns the author of the manifest.
func (Manifest) GetVersion ¶
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 (*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 (*PacketManager) GetMovePlayer ¶
func (*PacketManager) GetNetworkChunkPublisherUpdatePacket ¶
func (*PacketManager) GetPlayStatus ¶
func (protocol *PacketManager) GetPlayStatus(status int32) packets.IPacket
func (*PacketManager) GetPlayerAction ¶
func (*PacketManager) GetPlayerList ¶
func (protocol *PacketManager) GetPlayerList(listType byte, players map[string]protocol.PlayerListEntry) packets.IPacket
func (*PacketManager) GetPlayerSkin ¶
func (*PacketManager) GetRemoveEntity ¶
func (protocol *PacketManager) GetRemoveEntity(uniqueId int64) packets.IPacket
func (*PacketManager) GetResourcePackChunkData ¶
func (*PacketManager) GetResourcePackDataInfo ¶
func (protocol *PacketManager) GetResourcePackDataInfo(pack packs.Pack) packets.IPacket
func (*PacketManager) GetResourcePackInfo ¶
func (*PacketManager) GetResourcePackStack ¶
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 ¶
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
func (*Plugin) GetAPIVersion ¶
GetAPIVersion returns the API Version of the plugin.
func (*Plugin) GetDescription ¶
GetDescription returns the description of the plugin.
func (*Plugin) GetOrganisation ¶
GetAuthor returns the author of the plugin.
func (*Plugin) GetVersion ¶
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 ¶
GeneratePongData generates the GoRakLib pong data for the UnconnectedPong RakNet packet.
func (*Server) GenerateQueryResult ¶
GenerateQueryResult returns the query data of the server in a byte array.
func (*Server) GetAddress ¶
GetAddress returns the IP address specified in the configuration.
func (*Server) GetAllowedViewDistance ¶
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 ¶
GetCurrentTick returns the current tick the server is on.
func (*Server) GetEngineName ¶
GetEngineName returns 'GoMine'.
func (*Server) GetMaxViewDistance ¶
Returns the max view distance allowed by the server
func (*Server) GetMaximumPlayers ¶
GetMaximumPlayers returns the maximum amount of players on the server.
func (*Server) GetMinecraftNetworkVersion ¶
GetMinecraftNetworkVersion returns the latest Minecraft network version. For example: "1.2.10.1"
func (*Server) GetMinecraftVersion ¶
GetMinecraftVersion returns the latest Minecraft game version. It is prefixed with a 'v', for example: "v1.2.10.1"
func (*Server) GetPrivateKey ¶
func (server *Server) GetPrivateKey() *ecdsa.PrivateKey
GetPrivateKey returns the ECDSA private key of the server.
func (*Server) GetPublicKey ¶
GetPublicKey returns the ECDSA public key of the private key of the server.
func (*Server) GetServerToken ¶
GetServerToken returns the server token byte sequence.
func (*Server) HandleDisconnect ¶
HandleDisconnect handles a disconnection from a session.
func (*Server) HasPermission ¶
HasPermission returns if the server has a given permission. Always returns true to satisfy the ICommandSender interface.
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.