summaryrefslogtreecommitdiffstats
path: root/logic/minecraft/JarMod.cpp
blob: fce8a492b2878e1deba0b94bdcf43d287ed813b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "JarMod.h"
#include "logic/MMCJson.h"
using namespace MMCJson;

JarmodPtr Jarmod::fromJson(const QJsonObject &libObj, const QString &filename)
{
	JarmodPtr out(new Jarmod());
	if (!libObj.contains("name"))
	{
		throw JSONValidationError(filename +
								  "contains a jarmod that doesn't have a 'name' field");
	}
	out->name = libObj.value("name").toString();
	return out;
}

QJsonObject Jarmod::toJson()
{
	QJsonObject out;
	writeString(out, "name", name);
	return out;
}