Search in sources :

Example 6 with GameProfile

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

the class UserCache method getProfile.

public GameProfile getProfile(String s) {
    String s1 = s.toLowerCase(Locale.ROOT);
    UserCacheEntry usercacheentry = (UserCacheEntry) this.c.get(s1);
    if (usercacheentry != null && (new Date()).getTime() >= UserCacheEntry.a(usercacheentry).getTime()) {
        this.d.remove(usercacheentry.a().getId());
        this.c.remove(usercacheentry.a().getName().toLowerCase(Locale.ROOT));
        LinkedList linkedlist = this.e;
        synchronized (this.e) {
            this.e.remove(usercacheentry.a());
        }
        usercacheentry = null;
    }
    GameProfile gameprofile;
    if (usercacheentry != null) {
        gameprofile = usercacheentry.a();
        LinkedList linkedlist1 = this.e;
        synchronized (this.e) {
            this.e.remove(gameprofile);
            this.e.addFirst(gameprofile);
        }
    } else {
        gameprofile = a(this.f, s1);
        if (gameprofile != null) {
            this.a(gameprofile);
            usercacheentry = (UserCacheEntry) this.c.get(s1);
        }
    }
    this.c();
    return usercacheentry == null ? null : usercacheentry.a();
}
Also used : GameProfile(net.minecraft.util.com.mojang.authlib.GameProfile) Date(java.util.Date) LinkedList(java.util.LinkedList)

Example 7 with GameProfile

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

the class NameReferencingFileConverter method a.

public static String a(String s) {
    if (!UtilColor.b(s) && s.length() <= 16) {
        MinecraftServer minecraftserver = MinecraftServer.getServer();
        GameProfile gameprofile = minecraftserver.getUserCache().getProfile(s);
        if (gameprofile != null && gameprofile.getId() != null) {
            return gameprofile.getId().toString();
        } else if (!minecraftserver.N() && minecraftserver.getOnlineMode()) {
            ArrayList arraylist = Lists.newArrayList();
            GameProfileLookupCallback gameprofilelookupcallback = new GameProfileLookupCallback(minecraftserver, arraylist);
            a(minecraftserver, Lists.newArrayList(new String[] { s }), gameprofilelookupcallback);
            return arraylist.size() > 0 && ((GameProfile) arraylist.get(0)).getId() != null ? ((GameProfile) arraylist.get(0)).getId().toString() : "";
        } else {
            return EntityHuman.a(new GameProfile((UUID) null, s)).toString();
        }
    } else {
        return s;
    }
}
Also used : GameProfile(net.minecraft.util.com.mojang.authlib.GameProfile) ArrayList(java.util.ArrayList) UUID(java.util.UUID)

Example 8 with GameProfile

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

the class OpList method a.

public GameProfile a(String s) {
    Iterator iterator = this.e().values().iterator();
    OpListEntry oplistentry;
    do {
        if (!iterator.hasNext()) {
            return null;
        }
        oplistentry = (OpListEntry) iterator.next();
    } while (!s.equalsIgnoreCase(((GameProfile) oplistentry.getKey()).getName()));
    return (GameProfile) oplistentry.getKey();
}
Also used : GameProfile(net.minecraft.util.com.mojang.authlib.GameProfile) Iterator(java.util.Iterator)

Example 9 with GameProfile

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

the class OpListEntry 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 10 with GameProfile

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

the class PacketLoginOutSuccess method a.

public void a(PacketDataSerializer packetdataserializer) {
    String s = packetdataserializer.c(36);
    String s1 = packetdataserializer.c(16);
    UUID uuid = UUID.fromString(s);
    this.a = new GameProfile(uuid, s1);
}
Also used : GameProfile(net.minecraft.util.com.mojang.authlib.GameProfile) UUID(java.util.UUID)

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