/** * Disables activity tracking for the specified {@link Player} for the next tick. See {@link #disableTrackingFor(Player, int)} for more * information on how to use this method. * * @param player Player to disable tracking for. * @return The {@link AutoCloseable} that will re-enable the tracking when done. * * @see #disableTrackingFor(Player, int) */ default NoExceptionAutoClosable disableTrackingForPlayer(Player player) { return disableTrackingForPlayer(player, 1); }
/** * Gets all warps that have categories. * * @return The warps. */ default Map<WarpCategory, List<Warp>> getWarpsWithCategories() { return getWarpsWithCategories(x -> true); }
/** * Removes the nickname for the specified user. * * @param user The nickname to set. * @throws NicknameException if the nickname could not be set. */ default void removeNickname(User user) throws NicknameException { setNickname(user, null); }
/** * 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 result of a token's registered {@link TokenParser} on a {@link CommandSource} * * @param plugin The ID of the plugin that registered the token. * @param token The identifier that is passed to the {@link TokenParser}. * @param source The {@link CommandSource} to perform the operation with. * @param variables The variables that could be used in the token. * @return The {@link Text}, if any. */ default Optional<Text> applyToken(String plugin, String token, CommandSource source, Map<String, Object> variables) { Optional<TokenParser> tokenFunction = getTokenParser(plugin); return tokenFunction.flatMap(tokenParser -> tokenParser.parse(token, source, variables)); }
/** * Saves a kit. * * @param kit The kit. */ void saveKit(Kit kit);
/** * Parses a token that might be either a primary token or a standard token. * * @param token The token, without the delimiters. * @param source The source to apply the tokens with. * @return The token result, if it exists. */ default Optional<Text> parseToken(String token, CommandSource source) { return parseToken(token, source, null); }
/** * Gets the {@link RTPOptions} that contains the current * rtp configuration for a default world. * * @return The {@link RTPOptions} */ default RTPOptions options() { return options(null); }
/** * Gets the result of a primary token's registered {@link TokenParser} on a {@link CommandSource} * * @param primaryToken The primary identifier that parsed. * @param source The {@link CommandSource} to perform the operation with. * @return The {@link Text}, if any. */ default Optional<Text> applyPrimaryToken(String primaryToken, CommandSource source) { return applyPrimaryToken(primaryToken, source, Maps.newHashMap()); }
/** * Gets whether a warp exists. * * @param name The name to check for. * @return <code>true</code> if it exists, <code>false</code> otherwise. */ default boolean warpExists(String name) { return getWarp(name).isPresent(); }
/** * Gets the result of a token's registered {@link TokenParser} on a {@link CommandSource} * * @param plugin The ID of the plugin that registered the token. * @param token The identifier that is passed to the {@link TokenParser}. * @param source The {@link CommandSource} to perform the operation with. * @return The {@link Text}, if any. */ default Optional<Text> applyToken(String plugin, String token, CommandSource source) { return applyToken(plugin, token, source, Maps.newHashMap()); }
/** * 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)); }
/** * 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)); }
default Optional<Home> getHome(User user, String name) { return getHome(user.getUniqueId(), name); }
/** * Gets the user metadata for a player with the specified {@link User}. * @param user The {@link User}. * @return The {@link Result} if the user exists. */ default Optional<Result> getUserData(User user) { return getUserData(user.getUniqueId()); }
/** * Gets the number of homes the player currently has. * * @param user The {@link User} * @return The number of homes. */ default int getHomeCount(User user) { return getHomeCount(user.getUniqueId()); }
/** * 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()); }
/** * Disables activity tracking for the specified {@link Player} for the next tick. See {@link #disableTrackingFor(Player, int)} for more * information on how to use this method. * * @param player Player to disable tracking for. * @return The {@link AutoCloseable} that will re-enable the tracking when done. * @deprecated Use {@link #disableTrackingForPlayer(Player, int)} instead. * * @see #disableTrackingFor(Player, int) */ @Deprecated default AutoCloseable disableTrackingFor(Player player) { return disableTrackingForPlayer(player, 1); }
/** * Sets a user's nickname. * * @param user The {@link User} to change the nickname of * @param nickname The nickname, or {@code null} to remove it. * @throws NicknameException if the nickname could not be set. */ default void setNickname(User user, @Nullable Text nickname) throws NicknameException { setNickname(user, nickname, false); }