T - the sender type@NonnullByDefault public interface FunctionalCommandBuilder<T extends org.bukkit.command.CommandSender>
Command| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_INVALID_ARGUMENT_MESSAGE |
static String |
DEFAULT_INVALID_SENDER_MESSAGE |
static String |
DEFAULT_INVALID_USAGE_MESSAGE |
static String |
DEFAULT_NOT_CONSOLE_MESSAGE |
static String |
DEFAULT_NOT_OP_MESSAGE |
static String |
DEFAULT_NOT_PLAYER_MESSAGE |
| Modifier and Type | Method and Description |
|---|---|
default FunctionalCommandBuilder<T> |
assertArgument(int index,
Predicate<String> test)
Tests a given argument with the provided predicate.
|
FunctionalCommandBuilder<T> |
assertArgument(int index,
Predicate<String> test,
String failureMessage)
Tests a given argument with the provided predicate.
|
default FunctionalCommandBuilder<org.bukkit.command.ConsoleCommandSender> |
assertConsole()
Asserts that the sender is instance of ConsoleCommandSender, and sends them the default failure message if
they're not.
|
FunctionalCommandBuilder<org.bukkit.command.ConsoleCommandSender> |
assertConsole(String failureMessage)
Asserts that the sender is instance of ConsoleCommandSender, and sends them the failure message if they're not
|
default FunctionalCommandBuilder<T> |
assertFunction(Predicate<? super CommandContext<? extends T>> test)
Asserts that some function returns true.
|
FunctionalCommandBuilder<T> |
assertFunction(Predicate<? super CommandContext<? extends T>> test,
String failureMessage)
Asserts that some function returns true.
|
default FunctionalCommandBuilder<T> |
assertOp()
Asserts that the sender is op, and sends them the default failure message if they're not.
|
FunctionalCommandBuilder<T> |
assertOp(String failureMessage)
Asserts that the sender is op, and sends them the failure message if they don't have permission
|
default FunctionalCommandBuilder<T> |
assertPermission(String permission)
Asserts that the sender has the specified permission, and sends them the default failure message
if they don't have permission.
|
FunctionalCommandBuilder<T> |
assertPermission(String permission,
String failureMessage)
Asserts that the sender has the specified permission, and sends them the failure message if they
don't have permission.
|
default FunctionalCommandBuilder<org.bukkit.entity.Player> |
assertPlayer()
Asserts that the sender is instance of Player, and sends them the default failure message if they're not.
|
FunctionalCommandBuilder<org.bukkit.entity.Player> |
assertPlayer(String failureMessage)
Asserts that the sender is instance of Player, and sends them the failure message if they're not
|
default FunctionalCommandBuilder<T> |
assertSender(Predicate<T> test)
Tests the sender with the provided predicate.
|
FunctionalCommandBuilder<T> |
assertSender(Predicate<T> test,
String failureMessage)
Tests the sender with the provided predicate.
|
default FunctionalCommandBuilder<T> |
assertUsage(String usage)
Asserts that the arguments match the given usage string.
|
FunctionalCommandBuilder<T> |
assertUsage(String usage,
String failureMessage)
Asserts that the arguments match the given usage string.
|
FunctionalCommandBuilder<T> |
description(String description)
Sets the command description to the specified one.
|
Command |
handler(FunctionalCommandHandler<T> handler)
Builds this
FunctionalCommandBuilder into a Command instance. |
static FunctionalCommandBuilder<org.bukkit.command.CommandSender> |
newBuilder() |
FunctionalCommandBuilder<T> |
tabHandler(FunctionalTabHandler<T> tabHandler)
Sets the tab handler to the provided one.
|
static final String DEFAULT_NOT_OP_MESSAGE
static final String DEFAULT_NOT_PLAYER_MESSAGE
static final String DEFAULT_NOT_CONSOLE_MESSAGE
static final String DEFAULT_INVALID_USAGE_MESSAGE
static final String DEFAULT_INVALID_ARGUMENT_MESSAGE
static final String DEFAULT_INVALID_SENDER_MESSAGE
static FunctionalCommandBuilder<org.bukkit.command.CommandSender> newBuilder()
FunctionalCommandBuilder<T> description(String description)
description - the command descriptiondefault FunctionalCommandBuilder<T> assertFunction(Predicate<? super CommandContext<? extends T>> test)
test - the test to runFunctionalCommandBuilder<T> assertFunction(Predicate<? super CommandContext<? extends T>> test, @Nullable String failureMessage)
test - the test to runfailureMessage - the failure message if the test failsdefault FunctionalCommandBuilder<T> assertPermission(String permission)
permission - the permission to check forFunctionalCommandBuilder<T> assertPermission(String permission, @Nullable String failureMessage)
permission - the permission to check forfailureMessage - the failure message to send if they don't have permissiondefault FunctionalCommandBuilder<T> assertOp()
FunctionalCommandBuilder<T> assertOp(String failureMessage)
failureMessage - the failure message to send if they're not opdefault FunctionalCommandBuilder<org.bukkit.entity.Player> assertPlayer()
FunctionalCommandBuilder<org.bukkit.entity.Player> assertPlayer(String failureMessage)
failureMessage - the failure message to send if they're not a playerdefault FunctionalCommandBuilder<org.bukkit.command.ConsoleCommandSender> assertConsole()
FunctionalCommandBuilder<org.bukkit.command.ConsoleCommandSender> assertConsole(String failureMessage)
failureMessage - the failure message to send if they're not consoledefault FunctionalCommandBuilder<T> assertUsage(String usage)
usage - the usage stringFunctionalCommandBuilder<T> assertUsage(String usage, String failureMessage)
usage - the usage stringfailureMessage - the failure message to send if the arguments to not match the usagedefault FunctionalCommandBuilder<T> assertArgument(int index, Predicate<String> test)
null is passed to the predicate.index - the index of the argument to testtest - the test predicateFunctionalCommandBuilder<T> assertArgument(int index, Predicate<String> test, String failureMessage)
null is passed to the predicate.
"{arg}" and "{index}" will be replaced in the failure message with the index and actual argument value respectively.index - the index of the argument to testtest - the test predicatefailureMessage - the failure message to send if the predicate failsdefault FunctionalCommandBuilder<T> assertSender(Predicate<T> test)
test - the test predicateFunctionalCommandBuilder<T> assertSender(Predicate<T> test, String failureMessage)
test - the test predicatefailureMessage - the failure message to send if the predicate failsFunctionalCommandBuilder<T> tabHandler(FunctionalTabHandler<T> tabHandler)
tabHandler - the tab handlerCommand handler(FunctionalCommandHandler<T> handler)
FunctionalCommandBuilder into a Command instance.
The command will not be registered with the server until Command.register(String...) is called.handler - the command handlerCopyright © 2022. All rights reserved.