/** * Gets the number of homes the player currently has. * * @param user The {@link UUID} of the player * @return The number of homes. */ default int getHomeCount(UUID user) { return getHomes(user).size(); }
/** * Gets the {@link Home}s for the specified user, identified by their UUID. * * @param user The {@link UUID} * @return The homes. */ default List<Home> getHomes(User user) { return getHomes(user.getUniqueId()); }
@GET @Path("/home/{player}") @Permission({ "home", "list" }) @ApiOperation(value = "List homes", notes = "Get a list of all the homes of a player.") public Collection<CachedNamedLocation> listHomes( @PathParam("player") @ApiParam("The uuid of the player") CachedPlayer player) throws NotFoundException { Optional<NucleusHomeService> optSrv = NucleusAPI.getHomeService(); if (!optSrv.isPresent()) { throw new InternalServerErrorException("Nuclues home service not available"); } NucleusHomeService srv = optSrv.get(); return WebAPI.runOnMain( () -> srv.getHomes(player.getUUID()).stream() .map(CachedNamedLocation::new) .collect(Collectors.toList()) ); }