@SuppressWarnings( "unchecked" )
	private ByteBuf writeStatusPacket()
	{
		JSONObject root = new JSONObject();
		JSONObject version = new JSONObject();
		if(MCListener.pingAppearOffline)
		{
			version.put("name", "Offline");
			version.put("protocol", 0);
		}
		else
		{
			version.put("name", "1.8.0");
			version.put("protocol", 47);
		}
		
		JSONObject players = new JSONObject();
		players.put("max", MCListener.pingMaxPlayers);
		players.put("online", MCListener.pingCurPlayers);
		if(MCListener.pingDescription.length > 0)
		{
			JSONArray sample = new JSONArray();
			for(String line : MCListener.pingDescription)
			{
				UUID id = UUID.nameUUIDFromBytes(line.getBytes());
				JSONObject samplePart = new JSONObject();
				samplePart.put("name", line);
				samplePart.put("id", id.toString());
				sample.add(samplePart);
			}
			players.put("sample", sample);
		}
		
		root.put("version", version);
		root.put("players", players);
		root.put("description", MCListener.pingMOTD);
		
		if(MCListener.pingIcon != null)
			root.put("favicon", MCListener.pingIcon.getIconString());
		
		ByteBuf buffer = Unpooled.buffer();
		Utils.writeVarInt(buffer, 0);
		Utils.writeString(buffer, root.toJSONString());
		return buffer;
	}