use of net.minecraft.server.players.GameProfileCache in project pollen by MoonflowerTeam.
the class SkinHelper method init.
@ApiStatus.Internal
public static void init() {
AuthenticationService authenticationservice = new YggdrasilAuthenticationService(Minecraft.getInstance().getProxy());
sessionService = authenticationservice.createMinecraftSessionService();
gameProfileCache = new GameProfileCache(authenticationservice.createProfileRepository(), new File(Minecraft.getInstance().gameDirectory, MinecraftServer.USERID_CACHE_FILE.getName()));
}
use of net.minecraft.server.players.GameProfileCache in project refinedstorage by refinedmods.
the class LevelUtils method getFakePlayer.
public static FakePlayer getFakePlayer(ServerLevel level, @Nullable UUID owner) {
if (owner != null) {
GameProfileCache profileCache = level.getServer().getProfileCache();
Optional<GameProfile> profile = profileCache.get(owner);
if (profile.isPresent()) {
return FakePlayerFactory.get(level, profile.get());
}
}
return FakePlayerFactory.getMinecraft(level);
}
use of net.minecraft.server.players.GameProfileCache in project SkyblockBuilder by MelanX.
the class ListCommand method listPlayers.
private static int listPlayers(CommandSourceStack source, String teamName) throws CommandSyntaxException {
WorldUtil.checkSkyblock(source);
ServerLevel level = source.getLevel();
SkyblockSavedData data = SkyblockSavedData.get(level);
Team team = data.getTeam(teamName);
if (team == null) {
source.sendSuccess(new TranslatableComponent("skyblockbuilder.command.error.team_not_exist").withStyle(ChatFormatting.RED), false);
return 0;
}
GameProfileCache profileCache = source.getServer().getProfileCache();
source.sendSuccess(new TranslatableComponent("skyblockbuilder.command.info.team_detailed", team.getName(), team.getPlayers().size()).withStyle(ChatFormatting.GOLD), false);
team.getPlayers().forEach(id -> {
Optional<GameProfile> profile = profileCache.get(id);
if (profile.isPresent()) {
String name = profile.get().getName();
if (!StringUtil.isNullOrEmpty(name)) {
source.sendSuccess(new TextComponent("- " + name), false);
}
}
});
return 1;
}
Aggregations