Search in sources :

Example 11 with GameProfile

use of net.minecraft.util.com.mojang.authlib.GameProfile in project mc-dev by Bukkit.

the class PacketPlayOutNamedEntitySpawn method a.

public void a(PacketDataSerializer packetdataserializer) {
    this.a = packetdataserializer.a();
    UUID uuid = UUID.fromString(packetdataserializer.c(36));
    this.b = new GameProfile(uuid, packetdataserializer.c(16));
    int i = packetdataserializer.a();
    for (int j = 0; j < i; ++j) {
        String s = packetdataserializer.c(32767);
        String s1 = packetdataserializer.c(32767);
        String s2 = packetdataserializer.c(32767);
        this.b.getProperties().put(s, new Property(s, s1, s2));
    }
    this.c = packetdataserializer.readInt();
    this.d = packetdataserializer.readInt();
    this.e = packetdataserializer.readInt();
    this.f = packetdataserializer.readByte();
    this.g = packetdataserializer.readByte();
    this.h = packetdataserializer.readShort();
    this.j = DataWatcher.b(packetdataserializer);
}
Also used : GameProfile(net.minecraft.util.com.mojang.authlib.GameProfile) UUID(java.util.UUID) Property(net.minecraft.util.com.mojang.authlib.properties.Property)

Example 12 with GameProfile

use of net.minecraft.util.com.mojang.authlib.GameProfile in project mc-dev by Bukkit.

the class NameReferencingFileConverter method a.

private static void a(MinecraftServer minecraftserver, Collection collection, ProfileLookupCallback profilelookupcallback) {
    String[] astring = (String[]) Iterators.toArray(Iterators.filter(collection.iterator(), new PredicateEmptyList()), String.class);
    if (minecraftserver.getOnlineMode()) {
        minecraftserver.getGameProfileRepository().findProfilesByNames(astring, Agent.MINECRAFT, profilelookupcallback);
    } else {
        String[] astring1 = astring;
        int i = astring.length;
        for (int j = 0; j < i; ++j) {
            String s = astring1[j];
            UUID uuid = EntityHuman.a(new GameProfile((UUID) null, s));
            GameProfile gameprofile = new GameProfile(uuid, s);
            profilelookupcallback.onProfileLookupSucceeded(gameprofile);
        }
    }
}
Also used : GameProfile(net.minecraft.util.com.mojang.authlib.GameProfile) UUID(java.util.UUID)

Example 13 with GameProfile

use of net.minecraft.util.com.mojang.authlib.GameProfile in project mc-dev by Bukkit.

the class GameProfileBanEntry method b.

private static GameProfile b(JsonObject jsonobject) {
    if (jsonobject.has("uuid") && jsonobject.has("name")) {
        String s = jsonobject.get("uuid").getAsString();
        UUID uuid;
        try {
            uuid = UUID.fromString(s);
        } catch (Throwable throwable) {
            return null;
        }
        return new GameProfile(uuid, jsonobject.get("name").getAsString());
    } else {
        return null;
    }
}
Also used : GameProfile(net.minecraft.util.com.mojang.authlib.GameProfile) UUID(java.util.UUID)

Example 14 with GameProfile

use of net.minecraft.util.com.mojang.authlib.GameProfile in project mc-dev by Bukkit.

the class GameProfileSerializer method deserialize.

public static GameProfile deserialize(NBTTagCompound nbttagcompound) {
    String s = null;
    String s1 = null;
    if (nbttagcompound.hasKeyOfType("Name", 8)) {
        s = nbttagcompound.getString("Name");
    }
    if (nbttagcompound.hasKeyOfType("Id", 8)) {
        s1 = nbttagcompound.getString("Id");
    }
    if (UtilColor.b(s) && UtilColor.b(s1)) {
        return null;
    } else {
        UUID uuid;
        try {
            uuid = UUID.fromString(s1);
        } catch (Throwable throwable) {
            uuid = null;
        }
        GameProfile gameprofile = new GameProfile(uuid, s);
        if (nbttagcompound.hasKeyOfType("Properties", 10)) {
            NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Properties");
            Iterator iterator = nbttagcompound1.c().iterator();
            while (iterator.hasNext()) {
                String s2 = (String) iterator.next();
                NBTTagList nbttaglist = nbttagcompound1.getList(s2, 10);
                for (int i = 0; i < nbttaglist.size(); ++i) {
                    NBTTagCompound nbttagcompound2 = nbttaglist.get(i);
                    String s3 = nbttagcompound2.getString("Value");
                    if (nbttagcompound2.hasKeyOfType("Signature", 8)) {
                        gameprofile.getProperties().put(s2, new Property(s2, s3, nbttagcompound2.getString("Signature")));
                    } else {
                        gameprofile.getProperties().put(s2, new Property(s2, s3));
                    }
                }
            }
        }
        return gameprofile;
    }
}
Also used : GameProfile(net.minecraft.util.com.mojang.authlib.GameProfile) Iterator(java.util.Iterator) UUID(java.util.UUID) Property(net.minecraft.util.com.mojang.authlib.properties.Property)

Example 15 with GameProfile

use of net.minecraft.util.com.mojang.authlib.GameProfile in project mc-dev by Bukkit.

the class ServerPingPlayerSampleSerializer method a.

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"));
            }
            serverpingplayersample.a(agameprofile);
        }
    }
    return serverpingplayersample;
}
Also used : JsonArray(net.minecraft.util.com.google.gson.JsonArray) GameProfile(net.minecraft.util.com.mojang.authlib.GameProfile) JsonObject(net.minecraft.util.com.google.gson.JsonObject)

Aggregations

GameProfile (net.minecraft.util.com.mojang.authlib.GameProfile)26 UUID (java.util.UUID)10 Iterator (java.util.Iterator)6 ArrayList (java.util.ArrayList)3 LinkedList (java.util.LinkedList)3 Property (net.minecraft.util.com.mojang.authlib.properties.Property)3 Date (java.util.Date)2 JsonObject (net.minecraft.util.com.google.gson.JsonObject)2 BigInteger (java.math.BigInteger)1 ParseException (java.text.ParseException)1 JsonArray (net.minecraft.util.com.google.gson.JsonArray)1 JsonElement (net.minecraft.util.com.google.gson.JsonElement)1 AuthenticationUnavailableException (net.minecraft.util.com.mojang.authlib.exceptions.AuthenticationUnavailableException)1