-
Notifications
You must be signed in to change notification settings - Fork 4
Info Service
CaffeinatedRat edited this page Feb 20, 2013
·
8 revisions
The information service simply provides simple details about the server, most of which are pulled directly from your server.properties file.
These are the properties that are available from this service:
- Server Type Name (Available only in 1.1.4+)
- Server Name
- Minecraft Version
- Bukkit Version
- MOTD
- World Type
- Game Mode
- IP Address & Port
- World Time
- Is whitelisted
- Allows the Nether
- Allows the End
- Allows Flight
You can query the information service by invoking the service name info.
The following is an example of how to invoke the service.
var ws = new WebSocket('ws://192.168.1.1:25564' ); ws.onopen = function() { ws.send('info'); };
The following is the format of the response generated by the service.
{ name: string serverTypeName: string (Available in version 1.1.4+) serverName: string version: string bukkitVersion: string worldType: string allowsNether: boolean allowsEnd: boolean allowsFlight: boolean isWhiteListed: boolean motd: string gameMode: string port: number ipAddress: string serverTime: number Status: string }
The following is an example of the JSON data that is returned by this service.
{ "name": "CraftBukkit", "serverName": "Unknown Server", "version": "git-Bukkit-1.3.2-R2.0-b2396jnks (MC: 1.3.2)", "bukkitVersion": "1.3.2-R2.0", "worldType": "DEFAULT", "allowsNether": true, "allowsEnd": true, "allowsFlight": false, "isWhiteListed": true, "motd": "Caff's Sandbox", "gameMode": "SURVIVAL", "port": 25565, "ipAddress": "", "serverTime":19866, "Status": "SUCCESSFUL" }
The following is an example of how to use JQuery to parse the JSON data.
var json = jQuery.parseJSON(msg.data); if(json.Status == "SUCCESSFUL") { $('#minecraftServerName').text(json.serverName); $('#minecraftName').text(json.name); $('#minecraftVersion').text(json.version); $('#bukkitVersion').text(json.bukkitVersion); $('#motd').text(json.motd); $('#worldType').text(json.worldType); $('#gameMode').text(json.gameMode); $('#isWhiteListed').text(json.isWhiteListed); $('#allowsNether').text(json.allowsNether); $('#allowsEnd').text(json.allowsEnd); $('#allowsFlight').text(json.allowsFlight); $('#port').text(json.port); $('#ipAddress').text(json.ipAddress); }