network

This page will go over the networking API namespace.

This API is deprecated due to unstable implementation. Consider using the Packet API instead.

sendPacket(id, ...parameters): Undefined

receivePacket(id, ...parameters): Undefined

ArgumentTypeDescription

id

Number

Packet ID.

0x03 -> C03, 0x0F -> C0F

...parameters

Variable arguments: Any

Parameters for instantiation of packet. Mismatch between packet constructor parameters and this variable argument will cause the script throw an exception.

Those methods will either send a packet to the server, or force the client to receive a packet from the server.

Some packets might be unsupported. If the packet is not supported, the script will throw an exception.

Every valid packet should be supported.

isMultiplayer(): Boolean

This method will return if the client is connected to the server.

isSingleplayer(): Boolean

This method will return if the client is playing in singlepalyer.

getServerIP(): String

Returns the server IP, if the player is connected to a server. Otherwise, this returns null.

getServerName(): String

Returns the server name, if the player is connected to a server. Otherwise, this returns null.

getServerMOTD(): String

Returns the server MOTD (Message Of The Day, also known as the text under a server name), if the player is connected to a server.

Last updated