Package net.gcnt.additionsplus.api
Class CustomAction
java.lang.Object
net.gcnt.additionsplus.api.CustomAction
Class that contains all information about custom actions.
-
Constructor Summary
ConstructorDescriptionCustomAction(String identifier, List<String> aliases, ActionType type, boolean playersOnly, Consumer<QueuedAction> runnable)
-
Method Summary
Modifier and TypeMethodDescriptionboolean
containsTag(String actionString)
Check if a string contains this custom action.Get a list of aliases that can be used as a replacement for the default identifier.Get the java consumer that is being executed when the action is being requested.Get the identifier of the custom action.getType()
Get the action type of this custom action.boolean
Whether this action can only be executed as a player or also from the console.void
setAliases(List<String> aliases)
Set the list of aliases for a custom action.void
setPlayersOnly(boolean playersOnly)
Set whether the sender has to be a player.void
setType(ActionType type)
Set the action type of this custom action.
-
Constructor Details
-
CustomAction
public CustomAction(@Nonnull String identifier, @Nonnull List<String> aliases, @Nonnull ActionType type, boolean playersOnly, @Nonnull Consumer<QueuedAction> runnable)
-
-
Method Details
-
getIdentifier
Get the identifier of the custom action. Action is as follows: [identifier]- Returns:
String
action identifier.
-
getAliases
Get a list of aliases that can be used as a replacement for the default identifier.- Returns:
- List of
String
with all aliases.
-
setAliases
Set the list of aliases for a custom action.- Parameters:
aliases
- String list with all possible aliases.
-
getType
Get the action type of this custom action.- Returns:
ActionType
of the custom action.
-
setType
Set the action type of this custom action.- Parameters:
type
-CustomAction
type of action.
-
isPlayersOnly
public boolean isPlayersOnly()Whether this action can only be executed as a player or also from the console.- Returns:
Boolean
whether or the sender has to be a player.
-
setPlayersOnly
public void setPlayersOnly(boolean playersOnly)Set whether the sender has to be a player.- Parameters:
playersOnly
-Boolean
whether the sender should be a player.
-
containsTag
Check if a string contains this custom action.- Parameters:
actionString
- Action string to check.- Returns:
Boolean
whether the actionString contains this custom action.
-
getConsumer
Get the java consumer that is being executed when the action is being requested.- Returns:
Consumer
withQueuedAction
to be executed.
-