Skip to content

Instantly share code, notes, and snippets.

View zbee's full-sized avatar
👾

Ethan Henderson zbee

👾
View GitHub Profile
@zbee
zbee / Minecraft-API Example Fixes
Last active August 29, 2015 13:56
The Minecraft-API examples are rather derpy and not really working. I present you working ones.
CURRENT (BROKEN - It cannot possibly return a number of players from the API method that returns only true or false based on whether the server is up. The status method doesn't even return data.players)
var ip = "player.server.com";
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://minecraft-api.com/v1/status/?server=" + ip, true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
data = JSON.parse(xhr.responseText);
if (data.status) {