本文整理汇总了Java中net.minecraft.server.management.PlayerProfileCache类的典型用法代码示例。如果您正苦于以下问题:Java PlayerProfileCache类的具体用法?Java PlayerProfileCache怎么用?Java PlayerProfileCache使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlayerProfileCache类属于net.minecraft.server.management包,在下文中一共展示了PlayerProfileCache类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: DedicatedServer
import net.minecraft.server.management.PlayerProfileCache; //导入依赖的package包/类
public DedicatedServer(File anvilFileIn, DataFixer dataFixerIn, YggdrasilAuthenticationService authServiceIn, MinecraftSessionService sessionServiceIn, GameProfileRepository profileRepoIn, PlayerProfileCache profileCacheIn)
{
super(anvilFileIn, Proxy.NO_PROXY, dataFixerIn, authServiceIn, sessionServiceIn, profileRepoIn, profileCacheIn);
Thread thread = new Thread("Server Infinisleeper")
{
{
this.setDaemon(true);
this.start();
}
public void run()
{
while (true)
{
try
{
Thread.sleep(2147483647L);
}
catch (InterruptedException var2)
{
;
}
}
}
};
}
示例3: fetchNames
import net.minecraft.server.management.PlayerProfileCache; //导入依赖的package包/类
public static String[] fetchNames(UUID[] uuids)
{
PlayerProfileCache cache = WorldBorder.SERVER.func_152358_ax();
String[] names = new String[uuids.length];
// Makes sure server reads from cache first
cache.func_152657_b();
for (int i = 0; i < uuids.length; i++)
{
GameProfile profile = cache.func_152652_a(uuids[i]);
names[i] = (profile != null)
? profile.getName()
: "<unknown:" + uuids[i].toString() + ">";
}
return names;
}
示例4: MinecraftServer
import net.minecraft.server.management.PlayerProfileCache; //导入依赖的package包/类
public MinecraftServer(File p_i45281_1_, Proxy p_i45281_2_)
{
this.field_152366_X = new PlayerProfileCache(this, field_152367_a);
mcServer = this;
this.serverProxy = p_i45281_2_;
this.anvilFile = p_i45281_1_;
this.field_147144_o = new NetworkSystem(this);
this.commandManager = new ServerCommandManager();
this.anvilConverterForAnvilFile = new AnvilSaveConverter(p_i45281_1_);
this.field_152364_T = new YggdrasilAuthenticationService(p_i45281_2_, UUID.randomUUID().toString());
this.field_147143_S = this.field_152364_T.createMinecraftSessionService();
this.field_152365_W = this.field_152364_T.createProfileRepository();
this.primaryThread = new Thread(this, "Server thread"); // CraftBukkit
this.cauldronConfig = new CauldronConfig("cauldron.yml", "cauldron");
this.tileEntityConfig = new TileEntityConfig("tileentities.yml", "cauldron_te");
}
示例5: getUUID
import net.minecraft.server.management.PlayerProfileCache; //导入依赖的package包/类
@Override
public UUID getUUID()
{
if (cache != null)
return cache;
Minecraft mc = Minecraft.getMinecraft();
Session session = mc.getSession();
boolean online = true;
if (session.getToken().length() != 32 || session.getPlayerID().length() != 32)
{
online = false;
}
UUID uuid;
if (online)
{
PlayerProfileCache playerprofilecache = new PlayerProfileCache(MinecraftServer.getServer(), new File(mc.mcDataDir, MinecraftServer.field_152367_a.getName()));
uuid = playerprofilecache.func_152655_a(Minecraft.getMinecraft().getSession().getUsername()).getId();
}
else
{
uuid = EntityPlayer.func_146094_a(new GameProfile(null, session.getUsername().toLowerCase()));
}
cache = uuid;
return uuid;
}
示例6: getUUID
import net.minecraft.server.management.PlayerProfileCache; //导入依赖的package包/类
@Override
public UUID getUUID()
{
if (cache != null)
return cache;
Minecraft mc = Minecraft.getMinecraft();
Session session = mc.getSession();
boolean online = true;
if (session.getToken().length() != 32 || session.getPlayerID().length() != 32)
{
online = false;
}
UUID uuid;
if (online)
{
YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(mc.getProxy(), UUID.randomUUID().toString());
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
PlayerProfileCache playerprofilecache = new PlayerProfileCache(gameprofilerepository, new File(mc.mcDataDir, MinecraftServer.USER_CACHE_FILE.getName()));
uuid = playerprofilecache.getGameProfileForUsername(Minecraft.getMinecraft().getSession().getUsername()).getId();
}
else
{
uuid = EntityPlayer.getOfflineUUID(session.getUsername().toLowerCase());
}
cache = uuid;
return uuid;
}
示例7: MinecraftServer
import net.minecraft.server.management.PlayerProfileCache; //导入依赖的package包/类
public MinecraftServer(File workDir, Proxy proxy, File profileCacheDir)
{
this.serverProxy = proxy;
mcServer = this;
this.anvilFile = workDir;
this.networkSystem = new NetworkSystem(this);
this.profileCache = new PlayerProfileCache(this, profileCacheDir);
this.commandManager = this.createNewCommandManager();
this.anvilConverterForAnvilFile = new AnvilSaveConverter(workDir);
this.authService = new YggdrasilAuthenticationService(proxy, UUID.randomUUID().toString());
this.sessionService = this.authService.createMinecraftSessionService();
this.profileRepo = this.authService.createProfileRepository();
}
示例8: MinecraftServer
import net.minecraft.server.management.PlayerProfileCache; //导入依赖的package包/类
public MinecraftServer(Proxy proxy, File workDir)
{
this.serverProxy = proxy;
mcServer = this;
this.anvilFile = null;
this.networkSystem = null;
this.profileCache = new PlayerProfileCache(this, workDir);
this.commandManager = null;
this.anvilConverterForAnvilFile = null;
this.authService = new YggdrasilAuthenticationService(proxy, UUID.randomUUID().toString());
this.sessionService = this.authService.createMinecraftSessionService();
this.profileRepo = this.authService.createProfileRepository();
}
示例9: IntegratedServer
import net.minecraft.server.management.PlayerProfileCache; //导入依赖的package包/类
public IntegratedServer(Minecraft clientIn, String folderNameIn, String worldNameIn, WorldSettings worldSettingsIn, YggdrasilAuthenticationService authServiceIn, MinecraftSessionService sessionServiceIn, GameProfileRepository profileRepoIn, PlayerProfileCache profileCacheIn)
{
super(new File(clientIn.mcDataDir, "saves"), clientIn.getProxy(), clientIn.getDataFixer(), authServiceIn, sessionServiceIn, profileRepoIn, profileCacheIn);
this.setServerOwner(clientIn.getSession().getUsername());
this.setFolderName(folderNameIn);
this.setWorldName(worldNameIn);
this.setDemo(clientIn.isDemo());
this.canCreateBonusChest(worldSettingsIn.isBonusChestEnabled());
this.setBuildLimit(256);
this.setPlayerList(new IntegratedPlayerList(this));
this.mc = clientIn;
this.theWorldSettings = this.isDemo() ? DemoWorldServer.DEMO_WORLD_SETTINGS : worldSettingsIn;
}
示例10: MinecraftServer
import net.minecraft.server.management.PlayerProfileCache; //导入依赖的package包/类
public MinecraftServer(File anvilFileIn, Proxy proxyIn, DataFixer dataFixerIn, YggdrasilAuthenticationService authServiceIn, MinecraftSessionService sessionServiceIn, GameProfileRepository profileRepoIn, PlayerProfileCache profileCacheIn)
{
this.serverProxy = proxyIn;
this.authService = authServiceIn;
this.sessionService = sessionServiceIn;
this.profileRepo = profileRepoIn;
this.profileCache = profileCacheIn;
this.anvilFile = anvilFileIn;
this.networkSystem = new NetworkSystem(this);
this.commandManager = this.createNewCommandManager();
this.anvilConverterForAnvilFile = new AnvilSaveConverter(anvilFileIn, dataFixerIn);
this.dataFixer = dataFixerIn;
}
示例11: constructServerInstance
import net.minecraft.server.management.PlayerProfileCache; //导入依赖的package包/类
@Nonnull
private DedicatedServer constructServerInstance(@Nonnull BundleContext ctx) {
logger.info("Initializing Minecraft %s", FaucetVersion.API_VERSION);
Bootstrap.register(); // apparently this is how the registries work ... don't question it
// log some environment information
logger.info("Running on Java v%s supplied by %s", System.getProperty("java.version", "Unknown"),
System.getProperty("java.vendor"));
// TODO: Integrate with plugins here?
YggdrasilAuthenticationService var15 = new YggdrasilAuthenticationService(Proxy.NO_PROXY,
UUID.randomUUID().toString());
MinecraftSessionService var16 = var15.createMinecraftSessionService();
GameProfileRepository var17 = var15.createProfileRepository();
PlayerProfileCache var18 = new PlayerProfileCache(var17, new File(".", "usercache.json"));
DedicatedServer server = new DedicatedServer(new File("."), DataFixesManager.createFixer(),
var15, var16, var17, var18);
// TODO: Re-introduce configuration
if (!GraphicsEnvironment.isHeadless()) {
logger.info("Server GUI has been disabled or is unavailable in this environment");
// TODO: Custom GUI
} else {
logger
.info("Server GUI has been disabled or is not available within the current environment");
}
return server;
}
示例12: FakeServer
import net.minecraft.server.management.PlayerProfileCache; //导入依赖的package包/类
public FakeServer(Minecraft clientIn, String folderNameIn, String worldNameIn, WorldSettings worldSettingsIn,
YggdrasilAuthenticationService authServiceIn, MinecraftSessionService sessionServiceIn,
GameProfileRepository profileRepoIn, PlayerProfileCache profileCacheIn)
{
super(new File(clientIn.mcDataDir, "saves"), null, clientIn.getDataFixer(), authServiceIn, sessionServiceIn, profileRepoIn, profileCacheIn);
this.setPlayerList(new FakePlayerList(this));
}
示例13: MinecraftServer
import net.minecraft.server.management.PlayerProfileCache; //导入依赖的package包/类
public MinecraftServer(File p_i45281_1_, Proxy p_i45281_2_)
{
this.field_152366_X = new PlayerProfileCache(this, field_152367_a);
mcServer = this;
this.serverProxy = p_i45281_2_;
this.anvilFile = p_i45281_1_;
this.field_147144_o = new NetworkSystem(this);
this.commandManager = new ServerCommandManager();
this.anvilConverterForAnvilFile = new AnvilSaveConverter(p_i45281_1_);
this.field_152364_T = new YggdrasilAuthenticationService(p_i45281_2_, UUID.randomUUID().toString());
this.field_147143_S = this.field_152364_T.createMinecraftSessionService();
this.field_152365_W = this.field_152364_T.createProfileRepository();
}
示例14: setGameProfileLookupService
import net.minecraft.server.management.PlayerProfileCache; //导入依赖的package包/类
@Override
public void setGameProfileLookupService()
{
YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(Minecraft.getMinecraft().getProxy(), UUID.randomUUID().toString());
EntityHelper.sessionService = yggdrasilauthenticationservice.createMinecraftSessionService();
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
EntityHelper.profileCache = new PlayerProfileCache(gameprofilerepository, new File(Minecraft.getMinecraft().mcDataDir, MinecraftServer.USER_CACHE_FILE.getName()));
}
示例15: 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")));
}
}
}