Package net.minecraft.util.com.google.gson

Examples of net.minecraft.util.com.google.gson.JsonObject


public class ServerPingServerDataSerializer implements JsonDeserializer, JsonSerializer {

    public ServerPingServerDataSerializer() {}

    public ServerPingServerData a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) {
        JsonObject jsonobject = ChatDeserializer.l(jsonelement, "version");

        return new ServerPingServerData(ChatDeserializer.h(jsonobject, "name"), ChatDeserializer.m(jsonobject, "protocol"));
    }
View Full Code Here


        return new ServerPingServerData(ChatDeserializer.h(jsonobject, "name"), ChatDeserializer.m(jsonobject, "protocol"));
    }

    public JsonElement a(ServerPingServerData serverpingserverdata, Type type, JsonSerializationContext jsonserializationcontext) {
        JsonObject jsonobject = new JsonObject();

        jsonobject.addProperty("name", serverpingserverdata.a());
        jsonobject.addProperty("protocol", Integer.valueOf(serverpingserverdata.b()));
        return jsonobject;
    }
View Full Code Here

    public ChatModifierSerializer() {}

    public ChatModifier a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) {
        if (jsonelement.isJsonObject()) {
            ChatModifier chatmodifier = new ChatModifier();
            JsonObject jsonobject = jsonelement.getAsJsonObject();

            if (jsonobject == null) {
                return null;
            } else {
                if (jsonobject.has("bold")) {
                    ChatModifier.a(chatmodifier, Boolean.valueOf(jsonobject.get("bold").getAsBoolean()));
                }

                if (jsonobject.has("italic")) {
                    ChatModifier.b(chatmodifier, Boolean.valueOf(jsonobject.get("italic").getAsBoolean()));
                }

                if (jsonobject.has("underlined")) {
                    ChatModifier.c(chatmodifier, Boolean.valueOf(jsonobject.get("underlined").getAsBoolean()));
                }

                if (jsonobject.has("strikethrough")) {
                    ChatModifier.d(chatmodifier, Boolean.valueOf(jsonobject.get("strikethrough").getAsBoolean()));
                }

                if (jsonobject.has("obfuscated")) {
                    ChatModifier.e(chatmodifier, Boolean.valueOf(jsonobject.get("obfuscated").getAsBoolean()));
                }

                if (jsonobject.has("color")) {
                    ChatModifier.a(chatmodifier, (EnumChatFormat) jsondeserializationcontext.deserialize(jsonobject.get("color"), EnumChatFormat.class));
                }

                JsonObject jsonobject1;
                JsonPrimitive jsonprimitive;

                if (jsonobject.has("clickEvent")) {
                    jsonobject1 = jsonobject.getAsJsonObject("clickEvent");
                    if (jsonobject1 != null) {
                        jsonprimitive = jsonobject1.getAsJsonPrimitive("action");
                        EnumClickAction enumclickaction = jsonprimitive == null ? null : EnumClickAction.a(jsonprimitive.getAsString());
                        JsonPrimitive jsonprimitive1 = jsonobject1.getAsJsonPrimitive("value");
                        String s = jsonprimitive1 == null ? null : jsonprimitive1.getAsString();

                        if (enumclickaction != null && s != null && enumclickaction.a()) {
                            ChatModifier.a(chatmodifier, new ChatClickable(enumclickaction, s));
                        }
                    }
                }

                if (jsonobject.has("hoverEvent")) {
                    jsonobject1 = jsonobject.getAsJsonObject("hoverEvent");
                    if (jsonobject1 != null) {
                        jsonprimitive = jsonobject1.getAsJsonPrimitive("action");
                        EnumHoverAction enumhoveraction = jsonprimitive == null ? null : EnumHoverAction.a(jsonprimitive.getAsString());
                        IChatBaseComponent ichatbasecomponent = (IChatBaseComponent) jsondeserializationcontext.deserialize(jsonobject1.get("value"), IChatBaseComponent.class);

                        if (enumhoveraction != null && ichatbasecomponent != null && enumhoveraction.a()) {
                            ChatModifier.a(chatmodifier, new ChatHoverable(enumhoveraction, ichatbasecomponent));
                        }
                    }
View Full Code Here

    public JsonElement a(ChatModifier chatmodifier, Type type, JsonSerializationContext jsonserializationcontext) {
        if (chatmodifier.g()) {
            return null;
        } else {
            JsonObject jsonobject = new JsonObject();

            if (ChatModifier.b(chatmodifier) != null) {
                jsonobject.addProperty("bold", ChatModifier.b(chatmodifier));
            }

            if (ChatModifier.c(chatmodifier) != null) {
                jsonobject.addProperty("italic", ChatModifier.c(chatmodifier));
            }

            if (ChatModifier.d(chatmodifier) != null) {
                jsonobject.addProperty("underlined", ChatModifier.d(chatmodifier));
            }

            if (ChatModifier.e(chatmodifier) != null) {
                jsonobject.addProperty("strikethrough", ChatModifier.e(chatmodifier));
            }

            if (ChatModifier.f(chatmodifier) != null) {
                jsonobject.addProperty("obfuscated", ChatModifier.f(chatmodifier));
            }

            if (ChatModifier.g(chatmodifier) != null) {
                jsonobject.add("color", jsonserializationcontext.serialize(ChatModifier.g(chatmodifier)));
            }

            JsonObject jsonobject1;

            if (ChatModifier.h(chatmodifier) != null) {
                jsonobject1 = new JsonObject();
                jsonobject1.addProperty("action", ChatModifier.h(chatmodifier).a().b());
                jsonobject1.addProperty("value", ChatModifier.h(chatmodifier).b());
                jsonobject.add("clickEvent", jsonobject1);
            }

            if (ChatModifier.i(chatmodifier) != null) {
                jsonobject1 = new JsonObject();
                jsonobject1.addProperty("action", ChatModifier.i(chatmodifier).a().b());
                jsonobject1.add("value", jsonserializationcontext.serialize(ChatModifier.i(chatmodifier).b()));
                jsonobject.add("hoverEvent", jsonobject1);
            }

            return jsonobject;
        }
View Full Code Here

public class ServerPingPlayerSampleSerializer implements JsonDeserializer, JsonSerializer {

    public ServerPingPlayerSampleSerializer() {}

    public ServerPingPlayerSample a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) {
        JsonObject jsonobject = ChatDeserializer.l(jsonelement, "players");
        ServerPingPlayerSample serverpingplayersample = new ServerPingPlayerSample(ChatDeserializer.m(jsonobject, "max"), ChatDeserializer.m(jsonobject, "online"));

        if (ChatDeserializer.d(jsonobject, "sample")) {
            JsonArray jsonarray = ChatDeserializer.t(jsonobject, "sample");

            if (jsonarray.size() > 0) {
                GameProfile[] agameprofile = new GameProfile[jsonarray.size()];

                for (int i = 0; i < agameprofile.length; ++i) {
                    JsonObject jsonobject1 = ChatDeserializer.l(jsonarray.get(i), "player[" + i + "]");
                    String s = ChatDeserializer.h(jsonobject1, "id");

                    agameprofile[i] = new GameProfile(UUID.fromString(s), ChatDeserializer.h(jsonobject1, "name"));
                }
View Full Code Here

        return serverpingplayersample;
    }

    public JsonElement a(ServerPingPlayerSample serverpingplayersample, Type type, JsonSerializationContext jsonserializationcontext) {
        JsonObject jsonobject = new JsonObject();

        jsonobject.addProperty("max", Integer.valueOf(serverpingplayersample.a()));
        jsonobject.addProperty("online", Integer.valueOf(serverpingplayersample.b()));
        if (serverpingplayersample.c() != null && serverpingplayersample.c().length > 0) {
            JsonArray jsonarray = new JsonArray();

            for (int i = 0; i < serverpingplayersample.c().length; ++i) {
                JsonObject jsonobject1 = new JsonObject();
                UUID uuid = serverpingplayersample.c()[i].getId();

                jsonobject1.addProperty("id", uuid == null ? "" : uuid.toString());
                jsonobject1.addProperty("name", serverpingplayersample.c()[i].getName());
                jsonarray.add(jsonobject1);
            }

            jsonobject.add("sample", jsonarray);
        }
View Full Code Here

    private JsonListEntrySerializer(JsonList jsonlist) {
        this.a = jsonlist;
    }

    public JsonElement a(JsonListEntry jsonlistentry, Type type, JsonSerializationContext jsonserializationcontext) {
        JsonObject jsonobject = new JsonObject();

        jsonlistentry.a(jsonobject);
        return jsonobject;
    }
View Full Code Here

        return jsonobject;
    }

    public JsonListEntry a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) {
        if (jsonelement.isJsonObject()) {
            JsonObject jsonobject = jsonelement.getAsJsonObject();
            JsonListEntry jsonlistentry = this.a.a(jsonobject);

            return jsonlistentry;
        } else {
            return null;
View Full Code Here

    private BanEntrySerializer(UserCache usercache) {
        this.a = usercache;
    }

    public JsonElement a(UserCacheEntry usercacheentry, Type type, JsonSerializationContext jsonserializationcontext) {
        JsonObject jsonobject = new JsonObject();

        jsonobject.addProperty("name", usercacheentry.a().getName());
        UUID uuid = usercacheentry.a().getId();

        jsonobject.addProperty("uuid", uuid == null ? "" : uuid.toString());
        jsonobject.addProperty("expiresOn", UserCache.a.format(usercacheentry.b()));
        return jsonobject;
    }
View Full Code Here

        return jsonobject;
    }

    public UserCacheEntry a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) {
        if (jsonelement.isJsonObject()) {
            JsonObject jsonobject = jsonelement.getAsJsonObject();
            JsonElement jsonelement1 = jsonobject.get("name");
            JsonElement jsonelement2 = jsonobject.get("uuid");
            JsonElement jsonelement3 = jsonobject.get("expiresOn");

            if (jsonelement1 != null && jsonelement2 != null) {
                String s = jsonelement2.getAsString();
                String s1 = jsonelement1.getAsString();
                Date date = null;
View Full Code Here

TOP

Related Classes of net.minecraft.util.com.google.gson.JsonObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.