@Nullable private static IMailAddress getRecipient(MinecraftServer minecraftServer, String recipientName, EnumAddressee type) { switch (type) { case PLAYER: { GameProfile gameProfile = minecraftServer.getPlayerProfileCache().getGameProfileForUsername(recipientName); if (gameProfile == null) { return null; } return PostManager.postRegistry.getMailAddress(gameProfile); } case TRADER: { return PostManager.postRegistry.getMailAddress(recipientName); } default: return null; } }
/** * Restores the owner from other variables if he is null on loading. */ public void restoreOwnerIfNull() { final Map.Entry<UUID, Player> owner = getOwnerEntry(); if (owner == null && ownerUUID != null) { final GameProfile player = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerProfileCache().getProfileByUUID(ownerUUID); if (player != null) { players.put(ownerUUID, new Player(ownerUUID, player.getName(), Rank.OWNER)); } } }
public static GameProfile getProfile(UUID uuid, String name) { MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); GameProfile owner = server.getPlayerProfileCache().getProfileByUUID(uuid); if (owner == null) { GameProfile temp = new GameProfile(uuid, name); owner = server.getMinecraftSessionService().fillProfileProperties(temp, true); if (owner != temp) { server.getPlayerProfileCache().addEntry(owner); } } return owner; }
String[] names = server.getPlayerProfileCache().getUsernames();
public Optional<NBTTagCompound> cacheProfile(WorldServer worldServer, final String name) { Optional<GameProfile> gp = getProfile(name); if (!gp.isPresent()) { //noinspection ConstantConditions gp = Optional.ofNullable(worldServer.getMinecraftServer().getPlayerProfileCache().getGameProfileForUsername(name)); if (gp.isPresent()) { if (!gp.get().getProperties().get("textures").stream().findFirst().isPresent()) { gp = Optional.of(worldServer.getMinecraftServer().getMinecraftSessionService().fillProfileProperties(gp.get(), true)); } gp.ifPresent(this::cacheProfile); } } return gp.map(p -> { NBTTagCompound tagCompound = new NBTTagCompound(); NBTUtil.writeGameProfile(tagCompound, p); return tagCompound; }); }
public String getOwnerName() { return FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerProfileCache().getProfileByUUID(getOwner()).getName(); }
/** * Add a player to the rankings. * * @param player String playername of the player to add. * @param rank Rank desired starting rank. * @param world the world the player is in. * @return True if successful, otherwise false. */ public boolean addPlayer(@NotNull final String player, final Rank rank, final World world) { if (player.isEmpty()) { return false; } final GameProfile gameprofile = world.getMinecraftServer().getPlayerProfileCache().getGameProfileForUsername(player); //Check if the player already exists so that their rank isn't overridden return gameprofile != null && ownerUUID != gameprofile.getId() && addPlayer(gameprofile, rank); }
/** * Sets the player's rank to a given rank. * * @param id UUID of the player of the new rank. * @param rank Desired rank. * @param world the world the player is in. * @return True if successful, otherwise false. */ public boolean setPlayerRank(final UUID id, final Rank rank, final World world) { final Player player = getPlayers().get(id); if (player != null) { player.setRank(rank); markDirty(); AchievementUtils.syncAchievements(colony); } else { final GameProfile gameprofile = world.getMinecraftServer().getPlayerProfileCache().getProfileByUUID(id); return gameprofile != null && addPlayer(gameprofile, rank); } return true; }
private UUID findUUID(String name) { if (this.world == null || this.world.getMinecraftServer() == null) return EntityPlayer.getOfflineUUID(name); GameProfile profile = this.world.getMinecraftServer().getPlayerProfileCache().getGameProfileForUsername(name); return profile == null ? EntityPlayer.getOfflineUUID(name) : profile.getId(); }
public String getOwnerName() { GameProfile profile = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerProfileCache().getProfileByUUID(getOwner()); if(profile == null) { Logz.warn("Profile not found for owner: %s", getOwner()); return "Unknown"; } return profile.getName(); }
final GameProfile playerProfile = server.getPlayerProfileCache().getGameProfileForUsername(args[0]);
final GameProfile player = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerProfileCache().getProfileByUUID(id);
playerToTeleport = ServerUtils.getPlayerFromUUID(FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerProfileCache() .getGameProfileForUsername(playerName).getId(), world);