Deprecate old constructor

This commit is contained in:
Grig Alex 2020-10-24 00:04:33 +03:00
parent 5ea6fc9f09
commit cdef29f1ba
No known key found for this signature in database
GPG Key ID: 7176EDB56B1B35CB

View File

@ -29,7 +29,10 @@ public final class CommandRegistry implements ICommandRegistry {
* *
* @param allowCommandsWithUsername True to allow commands with username, false otherwise * @param allowCommandsWithUsername True to allow commands with username, false otherwise
* @param botUsername Bot username * @param botUsername Bot username
* @throws java.lang.NullPointerException if {@code botUsername} is {@code null}
* @deprecated Use {@link #CommandRegistry(boolean, java.util.function.Supplier)} instead
*/ */
@Deprecated
public CommandRegistry(boolean allowCommandsWithUsername, String botUsername) { public CommandRegistry(boolean allowCommandsWithUsername, String botUsername) {
Objects.requireNonNull(botUsername, "Bot username must not be null"); Objects.requireNonNull(botUsername, "Bot username must not be null");
this.allowCommandsWithUsername = allowCommandsWithUsername; this.allowCommandsWithUsername = allowCommandsWithUsername;
@ -134,6 +137,8 @@ public final class CommandRegistry implements ICommandRegistry {
* the command * the command
* @param command Command to simplify * @param command Command to simplify
* @return Simplified command * @return Simplified command
* @throws java.lang.NullPointerException if {@code allowCommandsWithUsername} is {@code true}
* and {@code botUsernameSupplier} returns {@code null}
*/ */
private String removeUsernameFromCommandIfNeeded(String command) { private String removeUsernameFromCommandIfNeeded(String command) {
if (allowCommandsWithUsername) { if (allowCommandsWithUsername) {