/** * Create a filter that restricts the messages returned to the provided substring. * * <p> * If multiple strings are set, all need to match. * </p> * * @param caseSensitive Whether this filter is case sensitive. * @param message The message. * @return The {@link MailFilter} */ default MailFilter createMessageFilter(final boolean caseSensitive, String... message) { return createMessageFilter(caseSensitive, Arrays.asList(message)); }
/** * Create a filter that restricts the mail to the senders provided. * * <p> * Multiple player filters can be provided - this will return messages authored by all specified players. * </p> * * @param includeConsole If <code>true</code>, include the console/plugins in any returned mail. * @param player The {@link UUID}s of the players. * @return The {@link MailFilter} */ default MailFilter createSenderFilter(boolean includeConsole, UUID... player) { return createSenderFilter(includeConsole, Arrays.asList(player)); }
@GET @Path("/mail/{player}") @Permission({ "mail", "list" }) @ApiOperation(value = "List mail", notes = "Get a list of all mail messages of a player.") public Collection<CachedMailMessage> listMail( @PathParam("player") @ApiParam("The uuid of the player") CachedPlayer player) throws NotFoundException { Optional<NucleusMailService> optSrv = NucleusAPI.getMailService(); if (!optSrv.isPresent()) { throw new InternalServerErrorException("Nuclues mail service not available"); } NucleusMailService srv = optSrv.get(); Optional<User> optUser = player.getUser(); if (!optUser.isPresent()) { throw new InternalServerErrorException("Could not get user"); } return WebAPI.runOnMain( () -> srv.getMail(optUser.get(), mailMessage -> { return true; }).stream() .map(CachedMailMessage::new) .collect(Collectors.toList()) ); }