How to write a protocol
Writing a protocol is fairly easy!You have to set up a project and either include the GameBrowser project or the GameBrowser.jar as library, so you're able to access all classes & API functions.
There're 4 methods you have to override.
Click the method name to jump to the documentation.
getInfo()
In this method you'll simply query the server.
Initialize a byte array with the data that is to be sent and use the Controller.send() method and return the response (the return value of Controller.send()).
Some servers send a reply even though you didn't use the correct protocol (e.g 0xFFFFFFFFdisconnect). So you might want to add a check if the reply contains a certain string/byte array and if it doesn't, return null.
The server will only be shown as not reachable if this method returns null!
processInfo()
In the processInfo() method you'll have to edit the passed ServerStatus object to save the gathered information and return it.
Basically you have to only set the map and the hasPassword attribute.
The reachable attribute is automatically set to true if a response arrives.
You also don't have to set the ping (this happens via magic).
getPlayers()
Overriding this method is optional! If the protocol doesn't support a player list at all just don't override it!
If it doesn't this is the place to read the player information from the status string or make another query if necessary.
getSupportedOptions()
This method returns the features the protocol supports (mapname, botregocnition...).
It will be returned as bitflags in an int32.
Just let it look like this:
{
}
The above example tells the software that FEATURE1, FEATURE2 and FEATURE3 are supported.
Now it is your job to gather the information about the protocol yourself!
Very good resources to protocol documentation are
int64.org documentation.
Alex Thissens wiki with additional links.