API reference / @jsprismarine/raknet / ServerName
Class: ServerName
Defined in: raknet/src/utils/ServerName.ts:43
Constructors
Constructor
new ServerName(
server,protocol):ServerName
Defined in: raknet/src/utils/ServerName.ts:65
Create a new server name for a RakNet server.
Parameters
server
The server instance.
protocol
The newest protocol and supported Minecraft releases to advertise.
Returns
ServerName
Methods
getGamemode()
getGamemode():
string
Defined in: raknet/src/utils/ServerName.ts:220
Returns
string
getMaxPlayerCount()
getMaxPlayerCount():
number
Defined in: raknet/src/utils/ServerName.ts:207
Get the maximum amount of players.
Returns
number
The maximum amount of players.
getMotd()
getMotd():
string
Defined in: raknet/src/utils/ServerName.ts:83
Get the message of the day.
Returns
string
the message of the day.
getName()
getName():
string
Defined in: raknet/src/utils/ServerName.ts:125
Get the server name.
Returns
string
The server name.
getOnlinePlayerCount()
getOnlinePlayerCount():
number
Defined in: raknet/src/utils/ServerName.ts:173
Get the amount of online players.
Returns
number
The amount of online players.
getPort()
getPort():
number
Defined in: raknet/src/utils/ServerName.ts:240
Get the port advertised in the MOTD.
Returns
number
The port.
getPortV6()
getPortV6():
number
Defined in: raknet/src/utils/ServerName.ts:257
Get the IPv6 port advertised in the MOTD.
Returns
number
The port.
getProtocol()
getProtocol():
number
Defined in: raknet/src/utils/ServerName.ts:141
Get the protocol version.
Returns
number
The protocol version.
getServerId()
getServerId():
bigint
Defined in: raknet/src/utils/ServerName.ts:228
Returns
bigint
getSnapshot()
getSnapshot():
ServerNameSnapshot
Defined in: raknet/src/utils/ServerName.ts:88
A serializable view of every field used to construct the unconnected pong.
Returns
getVersion()
getVersion():
string
Defined in: raknet/src/utils/ServerName.ts:157
Get the version of the server.
Returns
string
The version of the server.
onChange()
onChange(
listener): () =>void
Defined in: raknet/src/utils/ServerName.ts:108
Observes later changes, for keeping a worker-owned pong cache in sync.
Parameters
listener
(snapshot) => void
Called after a field changes.
Returns
A function that stops observing.
() => void
ownPlayerCount()
ownPlayerCount():
void
Defined in: raknet/src/utils/ServerName.ts:199
Takes the player count away from the sockets: from now on only ServerName.setOnlinePlayerCount changes it. For a server whose players arrive over more than RakNet, so one transport's sessions are not the whole count.
Returns
void
setGamemode()
setGamemode(
gamemode):void
Defined in: raknet/src/utils/ServerName.ts:223
Parameters
gamemode
string
Returns
void
setMaxPlayerCount()
setMaxPlayerCount(
count):void
Defined in: raknet/src/utils/ServerName.ts:215
Set the maximum amount of players.
Parameters
count
number
The maximum amount of players.
Returns
void
setMotd()
setMotd(
motd):void
Defined in: raknet/src/utils/ServerName.ts:116
Set the message of the day.
Parameters
motd
string
The message of the day.
Returns
void
setName()
setName(
name):void
Defined in: raknet/src/utils/ServerName.ts:132
Set the server name.
Parameters
name
string
The server name.
Returns
void
setOnlinePlayerCount()
setOnlinePlayerCount(
count):void
Defined in: raknet/src/utils/ServerName.ts:180
Set the amount of online players.
Parameters
count
number
The amount of online players.
Returns
void
setPort()
setPort(
port):void
Defined in: raknet/src/utils/ServerName.ts:248
Set the port advertised in the MOTD. ServerSocket.start sets it from the socket once it has bound, so a server asked to bind port 0 still advertises the port it got.
Parameters
port
number
The port the server is listening on.
Returns
void
setPortV6()
setPortV6(
port):void
Defined in: raknet/src/utils/ServerName.ts:265
Set the IPv6 port advertised in the MOTD. A socket bound to an IPv6 address sets it once it has bound, the way an IPv4 socket sets ServerName.setPort.
Parameters
port
number
The port the server is listening on for IPv6.
Returns
void
setProtocol()
setProtocol(
protocol):void
Defined in: raknet/src/utils/ServerName.ts:148
Set the protocol version.
Parameters
protocol
number
The protocol version.
Returns
void
setServerId()
setServerId(
id):void
Defined in: raknet/src/utils/ServerName.ts:231
Parameters
id
bigint
Returns
void
setSessionCount()
setSessionCount(
count):void
Defined in: raknet/src/utils/ServerName.ts:190
Reports how many sessions a RakNet socket holds, which is the advertised player count unless ServerName.ownPlayerCount handed the count to someone else.
Parameters
count
number
The socket's session count.
Returns
void
setVersion()
setVersion(
version):void
Defined in: raknet/src/utils/ServerName.ts:164
Set the version of the server.
Parameters
version
string
The version of the server.
Returns
void
toString()
toString():
string
Defined in: raknet/src/utils/ServerName.ts:281
The MOTD line an UnconnectedPong carries, in the order a Bedrock Dedicated Server broadcasts it.
Semicolon separated and terminated, and positional throughout: the client reads the ports to connect to a server it found on the local network, so a line that stops at the gamemode shows up in the list and cannot be joined from it. The tenth field is a flag rather than a count, and a line this long is dropped unless it is exactly 1.
Returns
string
The MOTD line.
See
https://github.com/Sandertv/gophertunnel/blob/master/minecraft/listener.go (updatePongData)