当前位置: 首页>>代码示例>>Java>>正文


Java GameProfile.getId方法代码示例

本文整理汇总了Java中com.mojang.authlib.GameProfile.getId方法的典型用法代码示例。如果您正苦于以下问题:Java GameProfile.getId方法的具体用法?Java GameProfile.getId怎么用?Java GameProfile.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.mojang.authlib.GameProfile的用法示例。


在下文中一共展示了GameProfile.getId方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fetchUUID

import com.mojang.authlib.GameProfile; //导入方法依赖的package包/类
public static UUID fetchUUID(String name)
{
    GameProfile profile = WorldBorder.SERVER
        .getPlayerProfileCache()
        .getGameProfileForUsername(name);

    if (profile == null)
        throw new RuntimeException(name + " is not a valid user");
    else
        return profile.getId();
}
 
开发者ID:abused,项目名称:World-Border,代码行数:12,代码来源:Profiles.java

示例2: convertMobOwnerIfNeeded

import com.mojang.authlib.GameProfile; //导入方法依赖的package包/类
public static String convertMobOwnerIfNeeded(final MinecraftServer server, String username)
{
    if (!StringUtils.isNullOrEmpty(username) && username.length() <= 16)
    {
        GameProfile gameprofile = server.getPlayerProfileCache().getGameProfileForUsername(username);

        if (gameprofile != null && gameprofile.getId() != null)
        {
            return gameprofile.getId().toString();
        }
        else if (!server.isSinglePlayer() && server.isServerInOnlineMode())
        {
            final List<GameProfile> list = Lists.<GameProfile>newArrayList();
            ProfileLookupCallback profilelookupcallback = new ProfileLookupCallback()
            {
                public void onProfileLookupSucceeded(GameProfile p_onProfileLookupSucceeded_1_)
                {
                    server.getPlayerProfileCache().addEntry(p_onProfileLookupSucceeded_1_);
                    list.add(p_onProfileLookupSucceeded_1_);
                }
                public void onProfileLookupFailed(GameProfile p_onProfileLookupFailed_1_, Exception p_onProfileLookupFailed_2_)
                {
                    PreYggdrasilConverter.LOGGER.warn("Could not lookup user whitelist entry for {}", new Object[] {p_onProfileLookupFailed_1_.getName(), p_onProfileLookupFailed_2_});
                }
            };
            lookupNames(server, Lists.newArrayList(new String[] {username}), profilelookupcallback);
            return !list.isEmpty() && ((GameProfile)list.get(0)).getId() != null ? ((GameProfile)list.get(0)).getId().toString() : "";
        }
        else
        {
            return EntityPlayer.getUUID(new GameProfile((UUID)null, username)).toString();
        }
    }
    else
    {
        return username;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:39,代码来源:PreYggdrasilConverter.java

示例3: hasPlayerHacked

import com.mojang.authlib.GameProfile; //导入方法依赖的package包/类
public boolean hasPlayerHacked(EntityPlayer player) {
    for (int i = 0; i < hackedUsers.size(); i++) {
        GameProfile user = hackedUsers.get(i);
        if (gameProfileEquals(user, player.getGameProfile())) {
            if (user.getId() == null && player.getGameProfile().getId() != null) {
                hackedUsers.set(i, player.getGameProfile());
                Log.info("Legacy conversion: Security Station hacked username '" + player.getName() + "' is now using UUID '" + player.getGameProfile().getId() + "'.");
            }
            return true;
        }
    }
    return false;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:14,代码来源:TileEntitySecurityStation.java

示例4: getUUID

import com.mojang.authlib.GameProfile; //导入方法依赖的package包/类
/**
 * Gets a players UUID given their GameProfie
 */
public static UUID getUUID(GameProfile profile)
{
    UUID uuid = profile.getId();

    if (uuid == null)
    {
        uuid = getOfflineUUID(profile.getName());
    }

    return uuid;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:15,代码来源:EntityPlayer.java

示例5: fromHandle

import com.mojang.authlib.GameProfile; //导入方法依赖的package包/类
public static GameProfileWrapper fromHandle(Object object) {
    Validate.isTrue(object instanceof GameProfile, "object is not a GameProfile");
    GameProfile gameProfile = (GameProfile) object;
    GameProfileWrapper wrapper = new GameProfileWrapper(gameProfile.getId(), gameProfile.getName());
    for (Map.Entry<String, Collection<Property>> entry : gameProfile.getProperties().asMap().entrySet()) {
        for (Property property : entry.getValue()) {
            wrapper.getProperties().put(entry.getKey(), PropertyWrapper.fromHandle(property));
        }
    }
    return wrapper;
}
 
开发者ID:Alvin-LB,项目名称:NameTagChanger,代码行数:12,代码来源:GameProfileWrapper.java

示例6: getStringUUIDFromName

import com.mojang.authlib.GameProfile; //导入方法依赖的package包/类
public static String getStringUUIDFromName(String p_152719_0_)
{
    if (!StringUtils.isNullOrEmpty(p_152719_0_) && p_152719_0_.length() <= 16)
    {
        final MinecraftServer minecraftserver = MinecraftServer.getServer();
        GameProfile gameprofile = minecraftserver.getPlayerProfileCache().getGameProfileForUsername(p_152719_0_);

        if (gameprofile != null && gameprofile.getId() != null)
        {
            return gameprofile.getId().toString();
        }
        else if (!minecraftserver.isSinglePlayer() && minecraftserver.isServerInOnlineMode())
        {
            final List<GameProfile> list = Lists.<GameProfile>newArrayList();
            ProfileLookupCallback profilelookupcallback = new ProfileLookupCallback()
            {
                public void onProfileLookupSucceeded(GameProfile p_onProfileLookupSucceeded_1_)
                {
                    minecraftserver.getPlayerProfileCache().addEntry(p_onProfileLookupSucceeded_1_);
                    list.add(p_onProfileLookupSucceeded_1_);
                }
                public void onProfileLookupFailed(GameProfile p_onProfileLookupFailed_1_, Exception p_onProfileLookupFailed_2_)
                {
                    PreYggdrasilConverter.LOGGER.warn((String)("Could not lookup user whitelist entry for " + p_onProfileLookupFailed_1_.getName()), (Throwable)p_onProfileLookupFailed_2_);
                }
            };
            lookupNames(minecraftserver, Lists.newArrayList(new String[] {p_152719_0_}), profilelookupcallback);
            return list.size() > 0 && ((GameProfile)list.get(0)).getId() != null ? ((GameProfile)list.get(0)).getId().toString() : "";
        }
        else
        {
            return EntityPlayer.getUUID(new GameProfile((UUID)null, p_152719_0_)).toString();
        }
    }
    else
    {
        return p_152719_0_;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:40,代码来源:PreYggdrasilConverter.java

示例7: addEntry

import com.mojang.authlib.GameProfile; //导入方法依赖的package包/类
/**
 * Add an entry to this cache
 */
private void addEntry(GameProfile gameProfile, Date expirationDate)
{
    UUID uuid = gameProfile.getId();

    if (expirationDate == null)
    {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.add(2, 1);
        expirationDate = calendar.getTime();
    }

    String s = gameProfile.getName().toLowerCase(Locale.ROOT);
    PlayerProfileCache.ProfileEntry playerprofilecache$profileentry = new PlayerProfileCache.ProfileEntry(gameProfile, expirationDate);

    if (this.uuidToProfileEntryMap.containsKey(uuid))
    {
        PlayerProfileCache.ProfileEntry playerprofilecache$profileentry1 = (PlayerProfileCache.ProfileEntry)this.uuidToProfileEntryMap.get(uuid);
        this.usernameToProfileEntryMap.remove(playerprofilecache$profileentry1.getGameProfile().getName().toLowerCase(Locale.ROOT));
        this.gameProfiles.remove(gameProfile);
    }

    this.usernameToProfileEntryMap.put(gameProfile.getName().toLowerCase(Locale.ROOT), playerprofilecache$profileentry);
    this.uuidToProfileEntryMap.put(uuid, playerprofilecache$profileentry);
    this.gameProfiles.addFirst(gameProfile);
    this.save();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:31,代码来源:PlayerProfileCache.java

示例8: isBlocked

import com.mojang.authlib.GameProfile; //导入方法依赖的package包/类
/**
 * Called from {@link NetHandlerLoginServer#tryAcceptPlayer()}
 */
public static boolean isBlocked(NetHandlerLoginServer login, GameProfile profile) {
    if(profile == null) return false;

    UUID uuid = profile.getId();
    if(uuid == null) return false;

    if(Blocker.isBlocked(uuid)) {
        login.func_194026_b(new TextComponentString(Blocker.MESSAGE));
        return true;
    }
    return false;
}
 
开发者ID:Guichaguri,项目名称:BOHA,代码行数:16,代码来源:BlockerHooks.java

示例9: getUUIDFromName

import com.mojang.authlib.GameProfile; //导入方法依赖的package包/类
public static UUID getUUIDFromName ( String name ) {
  
	GameProfile profile = MinecraftServer . getServer ( ) . func_152358_ax ( ) . func_152655_a ( name ) ;
   
    if (profile != null) {
    
    	return profile . getId ( ) ;
    
    } else {
    
    	MineDonate . logError ( "Null profile for name[" + name + "]!" ) ;
    
    }
    
    return null ;
    
}
 
开发者ID:Pishka,项目名称:MineDonate,代码行数:18,代码来源:Utils.java

示例10: getUUIDFromPlayer

import com.mojang.authlib.GameProfile; //导入方法依赖的package包/类
public static UUID getUUIDFromPlayer ( EntityPlayerMP serverPlayer ) {
	
    GameProfile profile = MinecraftServer . getServer ( ) . func_152358_ax ( ) . func_152655_a ( serverPlayer . getDisplayName ( ) ) ;
   
    if ( profile != null ) {
    	
        return profile . getId ( ) ;
        
    } else {
    	
    	MineDonate . logError ( "Null profile, for player[" + serverPlayer + "]!" ) ;
        
    }
    
    return null ;
    
}
 
开发者ID:Pishka,项目名称:MineDonate,代码行数:18,代码来源:Utils.java

示例11: writeGameProfile

import com.mojang.authlib.GameProfile; //导入方法依赖的package包/类
/**
 * Writes a GameProfile to an NBTTagCompound.
 */
public static NBTTagCompound writeGameProfile(NBTTagCompound tagCompound, GameProfile profile)
{
    if (!StringUtils.isNullOrEmpty(profile.getName()))
    {
        tagCompound.setString("Name", profile.getName());
    }

    if (profile.getId() != null)
    {
        tagCompound.setString("Id", profile.getId().toString());
    }

    if (!profile.getProperties().isEmpty())
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();

        for (String s : profile.getProperties().keySet())
        {
            NBTTagList nbttaglist = new NBTTagList();

            for (Property property : profile.getProperties().get(s))
            {
                NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                nbttagcompound1.setString("Value", property.getValue());

                if (property.hasSignature())
                {
                    nbttagcompound1.setString("Signature", property.getSignature());
                }

                nbttaglist.appendTag(nbttagcompound1);
            }

            nbttagcompound.setTag(s, nbttaglist);
        }

        tagCompound.setTag("Properties", nbttagcompound);
    }

    return tagCompound;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:45,代码来源:NBTUtil.java


注:本文中的com.mojang.authlib.GameProfile.getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。