Author Topic: Web-based Server list browser + API  (Read 2211 times)

https://bllist.theblackparrot.me/

Click on any of the servers listed to join them (steam/linux users, this doesn't work for you yet)



API: https://bllist.theblackparrot.me/api
All functions are sent with GET parameters to this address, and all results are returned in JSON with the server address as keys.

sort=[ip|port|locked|dedicated|name|players|gamemode|bricks]
Sort the results (in alphabetical order) based on the requested value

order=[asc|desc]
Sort order of the returned results

hide=[empty|full|locked]**
Hide servers from the results if they are empty, full, or locked.

pretty=[N/A]
Print results in a more readable, white-spaced format.

** Multiple values can be used here, chain them with a comma.
N/A As long as the parameter is set, this will turn it on

CORS is enabled, you can call this address with AJAX if you want with no issues.

Example request: https://bllist.theblackparrot.me/api/?sort=players&order=desc&hide=empty,full,locked&pretty=1



Github source: https://github.com/TheBlackParrot/blockland-master-server-browser

The api would probably be more useful if you sorted out the host's name from the server name.



very helpful tool / 10


The api would probably be more useful if you sorted out the host's name from the server name.
added that just now, see parsed_name in results

instead of keys with the address, why not just a list of the objects?

like, instead of
{
  "127.0.0.1:28000": { whatever },
  "87.58.245.134:28000": { stuff }
}


just this
{
  "servers": [
    { whatever },
    { stuff }
  ]
}


you already have the IP and port in the objects, so nothing is missing
I can't think of any benefit to having the keys set to the address, while on the other hand, having a list of servers on the servers key is both logical and more convenient for iteration, and opens up the possibility of having other top-level keys for, I dunno, whatever might be desired
« Last Edit: September 25, 2016, 01:01:42 PM by Foxscotch »

more convenient for iteration,

var keys = Object.keys(arr);
for(var key in keys) {
    console.log(arr[key]);
}




if you're wanting to change stuff around (e.g. have different keys), why not just mirror the master server yourself and code your own api?

var keys = Object.keys(arr);
for(var key in keys) {
    console.log(arr[key]);
}

not every language has iterable map types. and in most of those that do (python, js...), the order is meaningless, so if you wanna do any sorting (pretty much all the time, I think) you'll need to convert it to an array anyway
I'm having a hard time making heads or tails of that PHP, but it would not surprise me if you are specifically having to convert an array to a set of properties on one object in the first place
if you're wanting to change stuff around (e.g. have different keys), why not just mirror the master server yourself and code your own api?
it's just a suggestion. maybe you have a reason to do it your way, I don't know. that's why I asked

theres only 30 players online right now in-game holy crap thats bad

theres only 30 players online right now in-game holy crap thats bad
10-20 is pretty normal when america is asleep during school days

10-20 is pretty normal when america is asleep during school days
if we build the wall will that make our playercounts even worse cuz then the forign ppl cant get in

10-20 is pretty normal when america is asleep during school days
yeah when your main demographic is offline there aren't many players rofl