use of com.gmail.stefvanschiedev.buildinggame.utils.stats.StatType in project buildinggame by stefvanschie.
the class TopStatHologram method load.
/**
* Loads a single top stat hologram from a json reader. It is assumed the json reader is directly before the first
* opening brace of the object.
*
* @param reader the json reader to read from
* @since 6.2.0
*/
@Contract("null -> fail")
public static void load(@NotNull JsonReader reader) throws IOException {
reader.beginObject();
String name = null;
StatType type = null;
var values = 0;
Location location = null;
while (reader.hasNext()) {
switch(reader.nextName()) {
case "name":
name = reader.nextString();
break;
case "type":
type = StatType.valueOf(reader.nextString());
break;
case "values":
values = reader.nextInt();
break;
case "location":
location = JsonReaderUtil.parseLocation(reader);
break;
default:
break;
}
}
new TopStatHologram(name, type, values, location).register();
reader.endObject();
}
Aggregations