minecraft-source/src/com/mojang/realmsclient/dto/Ops.java

34 lines
1.0 KiB
Java
Raw Normal View History

2020-07-22 06:23:34 +01:00
package com.mojang.realmsclient.dto;
import java.util.Iterator;
import com.google.gson.JsonObject;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
2020-07-22 06:25:47 +01:00
import com.google.common.collect.Sets;
2020-07-22 06:23:34 +01:00
import java.util.Set;
public class Ops extends ValueObject {
public Set<String> ops;
public Ops() {
2020-07-22 06:25:47 +01:00
this.ops = Sets.newHashSet();
2020-07-22 06:23:34 +01:00
}
public static Ops parse(final String string) {
2020-07-22 06:32:50 +01:00
final Ops dii2 = new Ops();
2020-07-22 06:23:34 +01:00
final JsonParser jsonParser3 = new JsonParser();
try {
final JsonElement jsonElement4 = jsonParser3.parse(string);
final JsonObject jsonObject5 = jsonElement4.getAsJsonObject();
final JsonElement jsonElement5 = jsonObject5.get("ops");
if (jsonElement5.isJsonArray()) {
for (final JsonElement jsonElement6 : jsonElement5.getAsJsonArray()) {
2020-07-22 06:32:50 +01:00
dii2.ops.add(jsonElement6.getAsString());
2020-07-22 06:23:34 +01:00
}
}
}
catch (Exception ex) {}
2020-07-22 06:32:50 +01:00
return dii2;
2020-07-22 06:23:34 +01:00
}
}