Search in sources :

Example 1 with GameProfile

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

the class WhiteList method a.

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

Example 2 with GameProfile

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

the class TileEntitySkull method d.

private void d() {
    if (this.j != null && !UtilColor.b(this.j.getName())) {
        if (!this.j.isComplete() || !this.j.getProperties().containsKey("textures")) {
            GameProfile gameprofile = MinecraftServer.getServer().getUserCache().getProfile(this.j.getName());
            if (gameprofile != null) {
                Property property = (Property) Iterables.getFirst(gameprofile.getProperties().get("textures"), null);
                if (property == null) {
                    gameprofile = MinecraftServer.getServer().av().fillProfileProperties(gameprofile, true);
                }
                this.j = gameprofile;
                this.update();
            }
        }
    }
}
Also used : GameProfile(net.minecraft.util.com.mojang.authlib.GameProfile) Property(net.minecraft.util.com.mojang.authlib.properties.Property)

Example 3 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 4 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 5 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)

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