NodeServer

Singleton for the server instance.

final
class NodeServer : EventListener!NodeServerEvent, Server , HncomHandler!clientbound {}

Constructors

this
this(Address hub, Config config, Plugin[] plugins, string[] args)
Undocumented in source.

Members

Functions

addWorld
shared(WorldInfo) addWorld(GroupInfo group, E args)

Creates and registers a world in the given group, initialising its terrain, registering events, commands and tasks.

addWorld
shared(WorldInfo) addWorld(string name, E args)

Creates a group with the given name and adds the given world.

addWorldGroup
shared(GroupInfo) addWorldGroup(string name)

Creates a new group of worlds with the given name and starts it in a new thread. * This method only creates a group, which is a container for worlds, but no actual world. * To create a world the addWorld method must be used. * Example: * --- * auto group = server.addWorldGroup("MyGroup"); * auto world = server.addWorld(group, 0); // where 0 is the seed * ---

broadcast
void broadcast(ubyte[] payload)

Broadcasts a message to every node connected to the hub.

broadcast
void broadcast(string message)

Broadcasts a message in every registered group and their worlds` calling the world's broadcast method.

handleCloseResult
void handleCloseResult(CloseResult result)
Undocumented in source. Be warned that the author may not have intended to support it.
handlePlayerAdd
void handlePlayerAdd(HncomPlayer.Add packet)
Undocumented in source. Be warned that the author may not have intended to support it.
handlePlayerGamePacket
void handlePlayerGamePacket(HncomPlayer.GamePacket packet)
Undocumented in source. Be warned that the author may not have intended to support it.
handlePlayerRemove
void handlePlayerRemove(HncomPlayer.Remove packet)
Undocumented in source. Be warned that the author may not have intended to support it.
handlePlayerUpdateDisplayName
void handlePlayerUpdateDisplayName(HncomPlayer.UpdateDisplayName packet)
Undocumented in source. Be warned that the author may not have intended to support it.
handlePlayerUpdateLanguage
void handlePlayerUpdateLanguage(HncomPlayer.UpdateLanguage packet)
Undocumented in source. Be warned that the author may not have intended to support it.
handlePlayerUpdateLatency
void handlePlayerUpdateLatency(HncomPlayer.UpdateLatency packet)
Undocumented in source. Be warned that the author may not have intended to support it.
handlePlayerUpdatePacketLoss
void handlePlayerUpdatePacketLoss(HncomPlayer.UpdatePacketLoss packet)
Undocumented in source. Be warned that the author may not have intended to support it.
handlePlayerUpdatePermissionLevel
void handlePlayerUpdatePermissionLevel(HncomPlayer.UpdatePermissionLevel packet)
Undocumented in source. Be warned that the author may not have intended to support it.
handlePlayerUpdateViewDistance
void handlePlayerUpdateViewDistance(HncomPlayer.UpdateViewDistance packet)
Undocumented in source. Be warned that the author may not have intended to support it.
handleStatusAddNode
void handleStatusAddNode(HncomStatus.AddNode packet)
Undocumented in source. Be warned that the author may not have intended to support it.
handleStatusLatency
void handleStatusLatency(HncomStatus.Latency packet)
Undocumented in source. Be warned that the author may not have intended to support it.
handleStatusReceiveMessage
void handleStatusReceiveMessage(HncomStatus.ReceiveMessage packet)
Undocumented in source. Be warned that the author may not have intended to support it.
handleStatusRemoteCommand
void handleStatusRemoteCommand(HncomStatus.RemoteCommand packet)
Undocumented in source. Be warned that the author may not have intended to support it.
handleStatusRemoveNode
void handleStatusRemoveNode(HncomStatus.RemoveNode packet)
Undocumented in source. Be warned that the author may not have intended to support it.
handleStatusUpdateDisplayName
void handleStatusUpdateDisplayName(HncomStatus.UpdateDisplayName packet)
Undocumented in source. Be warned that the author may not have intended to support it.
handleStatusUpdateMOTD
void handleStatusUpdateMOTD(HncomStatus.UpdateMOTD packet)
Undocumented in source. Be warned that the author may not have intended to support it.
handleStatusUpdatePlayers
void handleStatusUpdatePlayers(HncomStatus.UpdatePlayers packet)
Undocumented in source. Be warned that the author may not have intended to support it.
handleStatusUpdateSupportedProtocols
void handleStatusUpdateSupportedProtocols(HncomStatus.UpdateSupportedProtocols packet)
Undocumented in source. Be warned that the author may not have intended to support it.
kick
void kick(uint hubId, string reason)
Undocumented in source. Be warned that the author may not have intended to support it.
kick
void kick(uint hubId, string reason, inout(string)[] args)

Registers a command.

logCommand
void logCommand(Message[] messages, int commandId)
Undocumented in source. Be warned that the author may not have intended to support it.
logWorld
void logWorld(Message[] messages, int worldId)
Undocumented in source. Be warned that the author may not have intended to support it.
nodeWithHubId
const(Node) nodeWithHubId(uint hubId)

Gets a node by its hub id, which is given by the hub and unique for every session.

nodeWithName
const(Node) nodeWithName(string name)

Gets a node by its name. It can be used to transfer players to it.

registerCommand
void registerCommand(void delegate(Parameters!func) del, string command, Description description, string[] aliases, ubyte permissionLevel, string[] permissions, bool hidden, bool implemented)

Registers a command.

removeWorld
void removeWorld(WorldInfo world)
Undocumented in source. Be warned that the author may not have intended to support it.
removeWorldGroup
bool removeWorldGroup(uint groupId)
Undocumented in source. Be warned that the author may not have intended to support it.
removeWorldGroup
bool removeWorldGroup(GroupInfo group)

Creates a group with the given name and adds the given world.

sendMessage
void sendMessage(Node[] nodes, ubyte[] payload)
void sendMessage(Node node, ubyte[] payload)

Sends a message to a node.

shutdown
void shutdown()

Stops the server setting the running variable to false and kicks every player from the server.

transfer
void transfer(uint hubId, Node node)
Undocumented in source. Be warned that the author may not have intended to support it.
updateGroupDifficulty
void updateGroupDifficulty(GroupInfo group, Difficulty difficulty)
Undocumented in source. Be warned that the author may not have intended to support it.
updateLanguageFiles
void updateLanguageFiles(string language, string[string] messages)

Updates langauge files (in config) and send the UpdateLanguageFiles packet to the hub if needed.

updatePlayerDisplayName
void updatePlayerDisplayName(uint hubId)
Undocumented in source. Be warned that the author may not have intended to support it.
updatePlayerGamemode
void updatePlayerGamemode(PlayerInfo player, Gamemode gamemode)
Undocumented in source. Be warned that the author may not have intended to support it.
updatePlayerPermissionLevel
void updatePlayerPermissionLevel(PlayerInfo player, PermissionLevel permissionLevel)
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

args
args [@property getter]

Gets the arguments the server has been launched with, excluding the ones * used to edit the configuration files.

commands
auto commands [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
config
const(Config) config [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
defaultWorld
shared(WorldInfo) defaultWorld [@property getter]

Gets the default world of the server's main group of worlds.

getGroupByName
string getGroupByName [@property setter]

Gets a world by its name.

hubAddress
Address hubAddress [@property getter]

Gets the address of the hub this node is connected to.

hubLatency
uint hubLatency [@property getter]

Gets the latency between the node and the hub.

hubMax
size_t hubMax [@property getter]

Gets the number of maximum players that can connect to the hub. If the value is 0 it means that no limit has been set and players will never be kicked because the server is full.

hubOnline
size_t hubOnline [@property getter]

Gets the number of online players in the whole server (not just in the current node).

id
immutable(long) id [@property getter]

Gets the server's id, which is equal in the hub and all connected nodes. It is generated by SEL's snooping system or randomly if the service cannot be reached.

isMainNode
bool isMainNode [@property getter]

Gets whether or not this is a main node (players are added when connected to hub) or not (player are added only when transferred by other nodes).

logger
Logger logger [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
mainWorldGroup
shared(GroupInfo) mainWorldGroup [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
max
size_t max [@property getter]

Gets the maximum number of players that can connect on the current node (not in the whole server). If the value is 0 there's no limit.

max
uint max [@property setter]

Sets the maximum number of players that can connect to the current node. 0 can be used for unlimited players.

name
string name [@property getter]

Gets the server's name, as indicated in the hub's settings.txt file. The name should just the name of the server without any formatting code nor description.

nextUUID
UUID nextUUID [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
nodeName
string nodeName [@property getter]

Gets the current's node name.

nodes
const(Node)[] nodes [@property getter]

Gets a list with the nodes connected to the hub, this excluded.

online
size_t online [@property getter]

Gets the number of online players in the current node (not in the whole server).

players
shared(PlayerInfo)[] players [@property getter]

Gets a list with all the players in the server.

plugins
const(Plugin)[] plugins [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
social
social [@property getter]

Gets the server's social informations like website and social networks' names.

uptime
Duration uptime [@property getter]

Gets the server's uptime as a Duration instance with milliseconds precision. The count starts when the node is duccessfully connected with the hub.

website
string website [@property getter]

Gets the server's website.

worldGroups
shared(GroupInfo)[] worldGroups [@property getter]

Gets a list with every world registered in the server. The list is a copy of the one kept by the server and its modification has no effect on the server.

Variables

globalListener
EventListener!WorldEvent globalListener;
Undocumented in source.
lite
bool lite;
Undocumented in source.
tid
std.concurrency.Tid tid;
Undocumented in source.

Inherited Members

From Server

config
const(Config) config [@property getter]

Gets the server's configuration.

files
const(Files) files [@property getter]

Gets the server's files (assets and temp files).

lang
const(LanguageManager) lang [@property getter]

Gets the server's language manager.

logger
Logger logger [@property getter]

Gets the server's logger.

plugins
const(Plugin)[] plugins [@property getter]

Gets the plugins actived on the server.

Meta