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


Java PlayerProfileCache.getProfileByUUID方法代码示例

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


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

示例1: fetchNames

import net.minecraft.server.management.PlayerProfileCache; //导入方法依赖的package包/类
public static String[] fetchNames(UUID[] uuids)
{
    PlayerProfileCache cache = WorldBorder.SERVER.getPlayerProfileCache();
    String[]           names = new String[uuids.length];

    // Makes sure server reads from cache first
    cache.load();

    for (int i = 0; i < uuids.length; i++)
    {
        GameProfile profile = cache.getProfileByUUID(uuids[i]);

        names[i] = (profile != null)
            ? profile.getName()
            : "<unknown:" + uuids[i].toString() + ">";
    }

    return names;
}
 
开发者ID:abused,项目名称:World-Border,代码行数:20,代码来源:Profiles.java

示例2: readVillageDataFromNBT

import net.minecraft.server.management.PlayerProfileCache; //导入方法依赖的package包/类
/**
 * Read this village's data from NBT.
 */
public void readVillageDataFromNBT(NBTTagCompound p_82690_1_)
{
    this.numVillagers = p_82690_1_.getInteger("PopSize");
    this.villageRadius = p_82690_1_.getInteger("Radius");
    this.numIronGolems = p_82690_1_.getInteger("Golems");
    this.lastAddDoorTimestamp = p_82690_1_.getInteger("Stable");
    this.tickCounter = p_82690_1_.getInteger("Tick");
    this.noBreedTicks = p_82690_1_.getInteger("MTick");
    this.center = new BlockPos(p_82690_1_.getInteger("CX"), p_82690_1_.getInteger("CY"), p_82690_1_.getInteger("CZ"));
    this.centerHelper = new BlockPos(p_82690_1_.getInteger("ACX"), p_82690_1_.getInteger("ACY"), p_82690_1_.getInteger("ACZ"));
    NBTTagList nbttaglist = p_82690_1_.getTagList("Doors", 10);

    for (int i = 0; i < nbttaglist.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
        VillageDoorInfo villagedoorinfo = new VillageDoorInfo(new BlockPos(nbttagcompound.getInteger("X"), nbttagcompound.getInteger("Y"), nbttagcompound.getInteger("Z")), nbttagcompound.getInteger("IDX"), nbttagcompound.getInteger("IDZ"), nbttagcompound.getInteger("TS"));
        this.villageDoorInfoList.add(villagedoorinfo);
    }

    NBTTagList nbttaglist1 = p_82690_1_.getTagList("Players", 10);

    for (int j = 0; j < nbttaglist1.tagCount(); ++j)
    {
        NBTTagCompound nbttagcompound1 = nbttaglist1.getCompoundTagAt(j);

        if (nbttagcompound1.hasKey("UUID"))
        {
            PlayerProfileCache playerprofilecache = MinecraftServer.getServer().getPlayerProfileCache();
            GameProfile gameprofile = playerprofilecache.getProfileByUUID(UUID.fromString(nbttagcompound1.getString("UUID")));

            if (gameprofile != null)
            {
                this.playerReputation.put(gameprofile.getName(), Integer.valueOf(nbttagcompound1.getInteger("S")));
            }
        }
        else
        {
            this.playerReputation.put(nbttagcompound1.getString("Name"), Integer.valueOf(nbttagcompound1.getInteger("S")));
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:45,代码来源:Village.java

示例3: readVillageDataFromNBT

import net.minecraft.server.management.PlayerProfileCache; //导入方法依赖的package包/类
/**
 * Read this village's data from NBT.
 */
public void readVillageDataFromNBT(NBTTagCompound compound)
{
    this.numVillagers = compound.getInteger("PopSize");
    this.villageRadius = compound.getInteger("Radius");
    this.numIronGolems = compound.getInteger("Golems");
    this.lastAddDoorTimestamp = compound.getInteger("Stable");
    this.tickCounter = compound.getInteger("Tick");
    this.noBreedTicks = compound.getInteger("MTick");
    this.center = new BlockPos(compound.getInteger("CX"), compound.getInteger("CY"), compound.getInteger("CZ"));
    this.centerHelper = new BlockPos(compound.getInteger("ACX"), compound.getInteger("ACY"), compound.getInteger("ACZ"));
    NBTTagList nbttaglist = compound.getTagList("Doors", 10);

    for (int i = 0; i < nbttaglist.tagCount(); ++i)
    {
        NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
        VillageDoorInfo villagedoorinfo = new VillageDoorInfo(new BlockPos(nbttagcompound.getInteger("X"), nbttagcompound.getInteger("Y"), nbttagcompound.getInteger("Z")), nbttagcompound.getInteger("IDX"), nbttagcompound.getInteger("IDZ"), nbttagcompound.getInteger("TS"));
        this.villageDoorInfoList.add(villagedoorinfo);
    }

    NBTTagList nbttaglist1 = compound.getTagList("Players", 10);

    for (int j = 0; j < nbttaglist1.tagCount(); ++j)
    {
        NBTTagCompound nbttagcompound1 = nbttaglist1.getCompoundTagAt(j);

        if (nbttagcompound1.hasKey("UUID") && this.worldObj != null && this.worldObj.getMinecraftServer() != null)
        {
            PlayerProfileCache playerprofilecache = this.worldObj.getMinecraftServer().getPlayerProfileCache();
            GameProfile gameprofile = playerprofilecache.getProfileByUUID(UUID.fromString(nbttagcompound1.getString("UUID")));

            if (gameprofile != null)
            {
                this.playerReputation.put(gameprofile.getName(), Integer.valueOf(nbttagcompound1.getInteger("S")));
            }
        }
        else
        {
            this.playerReputation.put(nbttagcompound1.getString("Name"), Integer.valueOf(nbttagcompound1.getInteger("S")));
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:45,代码来源:Village.java


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