Java 类net.minecraft.util.com.mojang.authlib.GameProfile 实例源码

项目:DiffUtils    文件:CraftServer_1710.java   
@Override
public OfflinePlayer getOfflinePlayer(UUID id) {
    Validate.notNull(id, "UUID cannot be null");

    OfflinePlayer result = getPlayer(id);
    if (result == null) {
        result = offlinePlayers.get(id);
        if (result == null) {
            result = new CraftOfflinePlayer(this, new GameProfile(id, null));
            offlinePlayers.put(id, result);
        }
    } else {
        offlinePlayers.remove(id);
    }

    return result;
}
项目:CraftBukkit    文件:CraftSkull.java   
public boolean setOwner(String name) {
    if (name == null || name.length() > MAX_OWNER_LENGTH) {
        return false;
    }

    GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(name);
    if (profile == null) {
        return false;
    }

    if (skullType != SkullType.PLAYER) {
        skullType = SkullType.PLAYER;
    }

    this.profile = profile;
    return true;
}
项目:CraftBukkit    文件:CraftProfileBanList.java   
@Override
public org.bukkit.BanEntry getBanEntry(String target) {
    Validate.notNull(target, "Target cannot be null");

    GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(target);
    if (profile == null) {
        return null;
    }

    GameProfileBanEntry entry = (GameProfileBanEntry) list.get(profile);
    if (entry == null) {
        return null;
    }

    return new CraftProfileBanEntry(profile, entry, list);
}
项目:CraftBukkit    文件:CraftProfileBanList.java   
@Override
public org.bukkit.BanEntry addBan(String target, String reason, Date expires, String source) {
    Validate.notNull(target, "Ban target cannot be null");

    GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(target);
    if (profile == null) {
        return null;
    }

    GameProfileBanEntry entry = new GameProfileBanEntry(profile, new Date(),
            StringUtils.isBlank(source) ? null : source, expires,
            StringUtils.isBlank(reason) ? null : reason);

    list.add(entry);

    try {
        list.save();
    } catch (IOException ex) {
        MinecraftServer.getLogger().error("Failed to save banned-players.json, " + ex.getMessage());
    }

    return new CraftProfileBanEntry(profile, entry, list);
}
项目:CraftBukkit    文件:CraftServer.java   
@Override
public OfflinePlayer getOfflinePlayer(UUID id) {
    Validate.notNull(id, "UUID cannot be null");

    OfflinePlayer result = getPlayer(id);
    if (result == null) {
        result = offlinePlayers.get(id);
        if (result == null) {
            result = new CraftOfflinePlayer(this, new GameProfile(id, null));
            offlinePlayers.put(id, result);
        }
    } else {
        offlinePlayers.remove(id);
    }

    return result;
}
项目:CraftBukkit    文件:PlayerDatFileConverter.java   
private String a(GameProfile gameprofile) {
    String s = null;

    for (int i = 0; i < this.e.length; ++i) {
        if (this.e[i] != null && this.e[i].equalsIgnoreCase(gameprofile.getName())) {
            s = this.e[i];
            break;
        }
    }

    if (s == null) {
        throw new FileConversionException("Could not find the filename for " + gameprofile.getName() + " anymore", (PredicateEmptyList) null);
    } else {
        return s;
    }
}
项目:CraftBukkit    文件:PacketPlayOutNamedEntitySpawn.java   
public void a(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws
    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);
}
项目:CraftBukkit    文件:NameReferencingFileConverter.java   
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);
        }
    }
}
项目:CraftBukkit    文件:NameReferencingFileConverter.java   
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;
    }
}
项目:CraftBukkit    文件:TileEntitySkull.java   
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();
            }
        }
    }
}
项目:NoHack    文件:NPCProfile.java   
@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }
    if (!(o instanceof GameProfile)) {
        return false;
    }

    GameProfile that = (GameProfile) o;

    if (uuid != null ? !uuid.equals(that.getId()) : that.getId() != null) {
        return false;
    }
    if (name != null ? !name.equals(that.getName()) : that.getName() != null) {
        return false;
    }

    return true;
}
项目:Tweakkit-Server    文件:CraftSkull.java   
public boolean setOwner(String name) {
    if (name == null || name.length() > MAX_OWNER_LENGTH) {
        return false;
    }

    GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(name);
    if (profile == null) {
        return false;
    }

    if (skullType != SkullType.PLAYER) {
        skullType = SkullType.PLAYER;
    }

    this.profile = profile;
    return true;
}
项目:Tweakkit-Server    文件:CraftProfileBanList.java   
@Override
public org.bukkit.BanEntry getBanEntry(String target) {
    Validate.notNull(target, "Target cannot be null");

    GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(target);
    if (profile == null) {
        return null;
    }

    GameProfileBanEntry entry = (GameProfileBanEntry) list.get(profile);
    if (entry == null) {
        return null;
    }

    return new CraftProfileBanEntry(profile, entry, list);
}
项目:Tweakkit-Server    文件:CraftProfileBanList.java   
@Override
public org.bukkit.BanEntry addBan(String target, String reason, Date expires, String source) {
    Validate.notNull(target, "Ban target cannot be null");

    GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(target);
    if (profile == null) {
        return null;
    }

    GameProfileBanEntry entry = new GameProfileBanEntry(profile, new Date(),
            StringUtils.isBlank(source) ? null : source, expires,
            StringUtils.isBlank(reason) ? null : reason);

    list.add(entry);

    try {
        list.save();
    } catch (IOException ex) {
        MinecraftServer.getLogger().error("Failed to save banned-players.json, " + ex.getMessage());
    }

    return new CraftProfileBanEntry(profile, entry, list);
}
项目:Tweakkit-Server    文件:CraftServer.java   
@Override
public OfflinePlayer getOfflinePlayer(UUID id) {
    Validate.notNull(id, "UUID cannot be null");

    OfflinePlayer result = getPlayer(id);
    if (result == null) {
        result = offlinePlayers.get(id);
        if (result == null) {
            result = new CraftOfflinePlayer(this, new GameProfile(id, null));
            offlinePlayers.put(id, result);
        }
    } else {
        offlinePlayers.remove(id);
    }

    return result;
}
项目:Tweakkit-Server    文件:LoginListener.java   
public void initUUID()
{
    UUID uuid;
    if ( networkManager.spoofedUUID != null )
    {
        uuid = networkManager.spoofedUUID;
    } else
    {
        uuid = UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + this.i.getName() ).getBytes( Charsets.UTF_8 ) );
    }

    this.i = new GameProfile( uuid, this.i.getName() );

    if (networkManager.spoofedProfile != null)
    {
        for ( Property property : networkManager.spoofedProfile )
        {
            this.i.getProperties().put( property.getName(), property );
        }
    }
}
项目:Tweakkit-Server    文件:PlayerDatFileConverter.java   
private String a(GameProfile gameprofile) {
    String s = null;

    for (int i = 0; i < this.e.length; ++i) {
        if (this.e[i] != null && this.e[i].equalsIgnoreCase(gameprofile.getName())) {
            s = this.e[i];
            break;
        }
    }

    if (s == null) {
        throw new FileConversionException("Could not find the filename for " + gameprofile.getName() + " anymore", (PredicateEmptyList) null);
    } else {
        return s;
    }
}
项目:Tweakkit-Server    文件:GameProfileBanEntry.java   
private static GameProfile b(JsonObject jsonobject) {
    // Spigot start
    // this whole method has to be reworked to account for the fact Bukkit only accepts UUID bans and gives no way for usernames to be stored!
    UUID uuid = null;
    String name = null;
    if (jsonobject.has("uuid")) {
        String s = jsonobject.get("uuid").getAsString();

        try {
            uuid = UUID.fromString(s);
        } catch (Throwable throwable) {
        }

    }
    if ( jsonobject.has("name"))
    {
        name = jsonobject.get("name").getAsString();
    }
    if ( uuid != null || name != null )
    {
        return new GameProfile( uuid, name );
    } else {
        return null;
    }
    // Spigot End
}
项目:Tweakkit-Server    文件:PacketPlayOutNamedEntitySpawn.java   
public void a(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws
    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);
}
项目:Tweakkit-Server    文件:NameReferencingFileConverter.java   
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() || org.spigotmc.SpigotConfig.bungee) { // Spigot: bungee = online mode, for now.
        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);
        }
    }
}
项目:Tweakkit-Server    文件:NameReferencingFileConverter.java   
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;
    }
}
项目:SkinChanger    文件:PlayerDisplayModifier.java   
private void updateSkin(WrappedGameProfile profile, String skinOwner) {
    try {
        JSONObject json = (JSONObject) new JSONParser().parse(profileCache.get(skinOwner));
        JSONArray properties = (JSONArray) json.get("properties");

        for (int i = 0; i < properties.size(); i++) {
            JSONObject property = (JSONObject) properties.get(i);
            String name = (String) property.get("name");
            String value = (String) property.get("value");
            String signature = (String) property.get("signature"); // May be NULL

            // Uncomment for ProtocolLib 3.4.0
            //profile.getProperties().put(name, new WrappedSignedProperty(name, value, signature));
            ((GameProfile) profile.getHandle()).getProperties().put(name, new Property(name, value, signature));
        }
    } catch (Exception e) {
        // ProtocolLib will throttle the number of exceptions printed to the console log
    }
}
项目:remote-entities-nxt    文件:RemotePlayerEntity.java   
public RemotePlayerEntity(MinecraftServer minecraftserver, WorldServer world, GameProfile profile, PlayerInteractManager iteminworldmanager)
{
    super(minecraftserver, world, profile, iteminworldmanager);
    try
    {
        NetworkManager manager = new RemoteEntityNetworkManager(minecraftserver);
        this.playerConnection = new NullNetServerHandler(minecraftserver, manager, this);
        manager.a(this.playerConnection);
    }
    catch(Exception e)
    {
    }

    this.bc().b(GenericAttributes.b).setValue(16);
    iteminworldmanager.setGameMode(EnumGamemode.SURVIVAL);
    this.noDamageTicks = 1;
    this.X = 1;
    this.fauxSleeping = true;
    this.m_navigation = new PlayerNavigation(this, this.world);
    this.m_senses = new PlayerSenses(this);
    this.m_controllerJump = new PlayerControllerJump(this);
    this.m_controllerMove = new PlayerControllerMove(this);
    this.m_controllerLook = new PlayerControllerLook(this);
}
项目:EndHQ-Libraries    文件:RemotePlayerEntity.java   
public RemotePlayerEntity(MinecraftServer minecraftserver, WorldServer world, GameProfile profile, PlayerInteractManager iteminworldmanager)
{
    super(minecraftserver, world, profile, iteminworldmanager);
    try
    {
        NetworkManager manager = new RemoteEntityNetworkManager(minecraftserver);
        this.playerConnection = new NullNetServerHandler(minecraftserver, manager, this);
        manager.a(this.playerConnection);
    }
    catch(Exception e)
    {
    }

    this.getAttributeMap().a(GenericAttributes.b).setValue(16);
    iteminworldmanager.setGameMode(EnumGamemode.SURVIVAL);
    this.noDamageTicks = 1;
    this.W = 1;
    this.fauxSleeping = true;
    this.m_navigation = new PlayerNavigation(this, this.world);
    this.m_senses = new PlayerSenses(this);
    this.m_controllerJump = new PlayerControllerJump(this);
    this.m_controllerMove = new PlayerControllerMove(this);
    this.m_controllerLook = new PlayerControllerLook(this);
}
项目:EntityAPI    文件:EntitySpawnHandler.java   
@Override
public ControllablePlayerHandle createPlayerHandle(ControllablePlayer player, Location location, String name, UUID uuid) {
    WorldServer worldServer = ((CraftWorld) location.getWorld()).getHandle();

    if (name.length() > 16)
        name = name.substring(0, 16);

    GameProfile profile = new GameProfile(uuid.toString().replaceAll("-", ""), name);

    ControllablePlayerEntity handle = new ControllablePlayerEntity(worldServer.getMinecraftServer(), worldServer, profile, new PlayerInteractManager(worldServer), player);
    handle.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
    worldServer.addEntity(handle);
    handle.world.players.remove(handle);

    if (location.getBlock().getRelative(BlockFace.DOWN).getType().isBlock())
        handle.onGround = true;

    return handle;
}
项目:EntityAPI    文件:EntitySpawnHandler.java   
@Override
public ControllablePlayerHandle createPlayerHandle(ControllablePlayer player, Location location, String name, UUID uuid) {
    WorldServer worldServer = ((CraftWorld) location.getWorld()).getHandle();

    if (name.length() > 16)
        name = name.substring(0, 16);

    GameProfile profile = new GameProfile(uuid.toString().replaceAll("-", ""), name);

    ControllablePlayerEntity handle = new ControllablePlayerEntity(worldServer.getMinecraftServer(), worldServer, profile, new PlayerInteractManager(worldServer), player);
    handle.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
    worldServer.addEntity(handle);
    handle.world.players.remove(handle);

    if (location.getBlock().getRelative(BlockFace.DOWN).getType().isBlock())
        handle.onGround = true;

    return handle;
}
项目:HCFCore    文件:LoggerEntityHuman.java   
private LoggerEntityHuman(Player player, WorldServer world) {
    super(MinecraftServer.getServer(), world, new GameProfile(player.getUniqueId(), player.getName()), new PlayerInteractManager((World)world));
    Location location = player.getLocation();
    double x = location.getX();
    double y = location.getY();
    double z = location.getZ();
    float yaw = location.getYaw();
    float pitch = location.getPitch();
    new FakePlayerConnection(this);
    this.playerConnection.a(x, y, z, yaw, pitch);
    EntityPlayer originPlayer = ((CraftPlayer)player).getHandle();
    this.lastDamager = originPlayer.lastDamager;
    this.invulnerableTicks = originPlayer.invulnerableTicks;
    this.combatTracker = originPlayer.combatTracker;
}
项目:HCFCore    文件:LoggerEntityHuman.java   
private LoggerEntityHuman(Player player, WorldServer world) {
    super(MinecraftServer.getServer(), world, new GameProfile(player.getUniqueId(), player.getName()), new PlayerInteractManager((World)world));
    Location location = player.getLocation();
    double x = location.getX();
    double y = location.getY();
    double z = location.getZ();
    float yaw = location.getYaw();
    float pitch = location.getPitch();
    new FakePlayerConnection(this);
    this.playerConnection.a(x, y, z, yaw, pitch);
    EntityPlayer originPlayer = ((CraftPlayer)player).getHandle();
    this.lastDamager = originPlayer.lastDamager;
    this.invulnerableTicks = originPlayer.invulnerableTicks;
    this.combatTracker = originPlayer.combatTracker;
}
项目:AnnihilationPro    文件:EntityNPCPlayer.java   
public static GameProfile makeProfile(String name, UUID skinId) {
    GameProfile profile = new GameProfile(UUID.randomUUID(), name);
    if (skinId != null) {
        GameProfile skin = new GameProfile(skinId, null);
        skin = NMS.getServer().av().fillProfileProperties(skin, true); //Srg = func_147130_as
        if (skin.getProperties().get("textures") == null || !skin.getProperties().get("textures").isEmpty()) {
            Property textures = skin.getProperties().get("textures").iterator().next();
            profile.getProperties().put("textures", textures);
        }
    }
    return profile; 
}
项目:DiffUtils    文件:CraftServer_1710.java   
@Override
@Deprecated
public OfflinePlayer getOfflinePlayer(String name) {
    Validate.notNull(name, "Name cannot be null");

    // If the name given cannot ever be a valid username give a dummy return, for scoreboard plugins
    if (!validUserPattern.matcher(name).matches()) {
        return new CraftOfflinePlayer(this, new GameProfile(invalidUserUUID, name));
    }

    OfflinePlayer result = getPlayerExact(name);
    if (result == null) {
        // This is potentially blocking :(
        GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(name);
        if (profile == null) {
            // Make an OfflinePlayer using an offline mode UUID since the name has no profile
            result = getOfflinePlayer(new GameProfile(UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)), name));
        } else {
            // Use the GameProfile even when we get a UUID so we ensure we still have a name
            result = getOfflinePlayer(profile);
        }
    } else {
        offlinePlayers.remove(result.getUniqueId());
    }

    return result;
}
项目:DiffUtils    文件:CraftServer_1710.java   
@Override
public Set<OfflinePlayer> getBannedPlayers() {
    Set<OfflinePlayer> result = new HashSet<OfflinePlayer>();

    for (JsonListEntry entry : playerList.getProfileBans().getValues()) {
        result.add(getOfflinePlayer((GameProfile) entry.getKey()));
    }

    return result;
}
项目:DiffUtils    文件:CraftServer_1710.java   
@Override
public Set<OfflinePlayer> getWhitelistedPlayers() {
    Set<OfflinePlayer> result = new LinkedHashSet<OfflinePlayer>();

    for (JsonListEntry entry : playerList.getWhitelist().getValues()) {
        result.add(getOfflinePlayer((GameProfile) entry.getKey()));
    }

    return result;
}
项目:DiffUtils    文件:CraftServer_1710.java   
@Override
public Set<OfflinePlayer> getOperators() {
    Set<OfflinePlayer> result = new HashSet<OfflinePlayer>();

    for (JsonListEntry entry : playerList.getOPs().getValues()) {
        result.add(getOfflinePlayer((GameProfile) entry.getKey()));
    }

    return result;
}
项目:CraftBukkit    文件:CraftProfileBanEntry.java   
public CraftProfileBanEntry(GameProfile profile, GameProfileBanEntry entry, GameProfileBanList list) {
    this.list = list;
    this.profile = profile;
    this.created = entry.getCreated() != null ? new Date(entry.getCreated().getTime()) : null;
    this.source = entry.getSource();
    this.expiration = entry.getExpires() != null ? new Date(entry.getExpires().getTime()) : null;
    this.reason = entry.getReason();
}
项目:CraftBukkit    文件:CraftProfileBanList.java   
@Override
public Set<org.bukkit.BanEntry> getBanEntries() {
    ImmutableSet.Builder<org.bukkit.BanEntry> builder = ImmutableSet.builder();
    for (JsonListEntry entry : list.getValues()) {
        GameProfile profile = (GameProfile) entry.getKey();
        builder.add(new CraftProfileBanEntry(profile, (GameProfileBanEntry) entry, list));
    }

    return builder.build();
}
项目:CraftBukkit    文件:CraftProfileBanList.java   
@Override
public boolean isBanned(String target) {
    Validate.notNull(target, "Target cannot be null");

    GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(target);
    if (profile == null) {
        return false;
    }

    return list.isBanned(profile);
}
项目:CraftBukkit    文件:CraftProfileBanList.java   
@Override
public void pardon(String target) {
    Validate.notNull(target, "Target cannot be null");

    GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(target);
    list.remove(profile);
}
项目:CraftBukkit    文件:CraftServer.java   
@Override
@Deprecated
public OfflinePlayer getOfflinePlayer(String name) {
    Validate.notNull(name, "Name cannot be null");

    // If the name given cannot ever be a valid username give a dummy return, for scoreboard plugins
    if (!validUserPattern.matcher(name).matches()) {
        return new CraftOfflinePlayer(this, new GameProfile(invalidUserUUID, name));
    }

    OfflinePlayer result = getPlayerExact(name);
    if (result == null) {
        // This is potentially blocking :(
        GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(name);
        if (profile == null) {
            // Make an OfflinePlayer using an offline mode UUID since the name has no profile
            result = getOfflinePlayer(new GameProfile(UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)), name));
        } else {
            // Use the GameProfile even when we get a UUID so we ensure we still have a name
            result = getOfflinePlayer(profile);
        }
    } else {
        offlinePlayers.remove(result.getUniqueId());
    }

    return result;
}
项目:CraftBukkit    文件:CraftServer.java   
@Override
public Set<OfflinePlayer> getBannedPlayers() {
    Set<OfflinePlayer> result = new HashSet<OfflinePlayer>();

    for (JsonListEntry entry : playerList.getProfileBans().getValues()) {
        result.add(getOfflinePlayer((GameProfile) entry.getKey()));
    }

    return result;
}
项目:CraftBukkit    文件:CraftServer.java   
@Override
public Set<OfflinePlayer> getWhitelistedPlayers() {
    Set<OfflinePlayer> result = new LinkedHashSet<OfflinePlayer>();

    for (JsonListEntry entry : playerList.getWhitelist().getValues()) {
        result.add(getOfflinePlayer((GameProfile) entry.getKey()));
    }

    return result;
}