💻 Server Settings API
The following APIs provide interfaces for customizing some server settings:
Get the Version Number of the BDS Server
mc.getBDSVersion()
- Return value: The server version number string, formatted like this:
v1.17.10 - Return value type:
String
Get BDS Server Protocol Version
mc.getServerProtocolVersion()
- Return value: Server protocol version
- Return value type:
Number
Get Server Motd String
Warning
This function is only available in 0.19.1 and later.
mc.getMotd()
- Return value: Current server Motd string
- Return value type:
String
Set Server Motd String
mc.setMotd(motd)
- Parameters:
- motd :
String
The desired Motd string. - Return value: Whether the setting was successful.
- Return value type:
Boolean
Set the Maximum Number of Players on the Server
mc.setMaxPlayers(num)
- Parameters:
- num :
Number
The maximum number of players. - Return value: Whether the setting was successful.
- Return value type:
Boolean
Get Online Player Count
Warning
This function is only available in 0.19.1 and later.
mc.getOnlinePlayerNum([ignoreSimulatedPlayer])
- Parameters:
- ignoreSimulatedPlayer :
Boolean=false
Whether to ignore simulated players - Return value: Current number of online players
- Return value type:
Number
Get Server Maximum Player Count
Warning
This function is only available in 0.19.1 and later.
mc.getMaxNumPlayers()
- Return value: Current maximum number of players on the server
- Return value type:
Number
Get Sever time
mc.getTime(TimeID)
- Parameters:
- TimeID :
Integer
Specifies the time to get. Must be 0, 1 or 2. (0 represents daytime, 1 represents gametime, 2 represents day) - Return value: Current time
- Return value type:
Integer
Among them, daytime is the number of game ticks since dawn, gametime is the age of the world in game ticks, day is the number of in-game days passed.
Set Sever time
mc.setTime(tick)
- Parameters:
- tick :
Integer
The time you want to set - Return value: Whether the setting was successful.
- Return value type:
Boolean
Get Sever Weather
mc.getWeather()
- Return value: Current weather (0 represents Clear, 1 represents Rain, 2 represents Thunder)
- Return value type:
Integer
Set Sever Weather
mc.setWeather(WeatherID)
- Parameters:
- WeatherID :
Integer
The weather you want to set (0 represents Clear, 1 represents Rain, 2 represents Thunder) - Return value: Whether the setting was successful.
- Return value type:
Boolean
Get Dimension ID
Warning
This function is only available in 0.19.1 and later.
mc.getDimensionId(name)
- Parameters:
- name :
String
Dimension name - Return value: Dimension ID corresponding to the dimension name, or
nullif the dimension name is invalid - Return value type:
Number
Get Dimension Name
Warning
This function is only available in 0.19.1 and later.
mc.getDimensionName(dimid)
- Parameters:
- dimid :
Integer
Dimension ID - Return value: Dimension name corresponding to the dimension ID, or
nullif the dimension ID is invalid - Return value type:
String