CommandAPI 9.3.0
An API for the command UI introduced in Minecraft 1.13
dev.jorel.commandapi.wrappers.SimpleFunctionWrapper Class Reference

A wrapper class for Minecraft 1.12's functions. More...

+ Inheritance diagram for dev.jorel.commandapi.wrappers.SimpleFunctionWrapper:

Public Member Functions

 SimpleFunctionWrapper (NamespacedKey minecraftKey, @SuppressWarnings("rawtypes") ToIntFunction invoker, String[] internalCommands)
 Creates a SimpleFunctionWrapper. More...
 
int run (CommandSender sender)
 Runs this function with a given CommandSender. More...
 
String[] getCommands ()
 Returns an array of commands that will be executed by this FunctionWrapper. More...
 
NamespacedKey getKey ()
 Returns the NamespacedKey that uniquely represents this object. More...
 

Static Public Member Functions

static SimpleFunctionWrapper[] getTag (NamespacedKey key)
 Returns a SimpleFunctionWrapper[], which is an array of all of the functions that this tag contains. More...
 
static SimpleFunctionWrapper getFunction (NamespacedKey key)
 Returns a SimpleFunctionWrapper representation of the Minecraft function for the provided NamespacedKey. More...
 
static Set< NamespacedKey > getFunctions ()
 Returns a set of all functions that the server has registered. More...
 
static Set< NamespacedKey > getTags ()
 Returns a set of all tags that the server has registered. More...
 

Detailed Description

A wrapper class for Minecraft 1.12's functions.

Constructor & Destructor Documentation

◆ SimpleFunctionWrapper()

dev.jorel.commandapi.wrappers.SimpleFunctionWrapper.SimpleFunctionWrapper ( NamespacedKey  minecraftKey,
@SuppressWarnings("rawtypes") ToIntFunction  invoker,
String[]  internalCommands 
)

Creates a SimpleFunctionWrapper.

Parameters
minecraftKeythe MinecraftKey which is used to reference this function
invokera method which, when invoked, runs the function
internalCommandsa String[] of internal commands that this customFunction represents. Typically customFunction.b().map(Object::toString)

Member Function Documentation

◆ getCommands()

String[] dev.jorel.commandapi.wrappers.SimpleFunctionWrapper.getCommands ( )

Returns an array of commands that will be executed by this FunctionWrapper.

Returns
the commands that are defined by this custom function

◆ getFunction()

static SimpleFunctionWrapper dev.jorel.commandapi.wrappers.SimpleFunctionWrapper.getFunction ( NamespacedKey  key)
static

Returns a SimpleFunctionWrapper representation of the Minecraft function for the provided NamespacedKey.

Parameters
keya NamespacedKey representation of the function
Returns
a SimpleFunctionWrapper representation of the Minecraft function for the provided NamespacedKey

◆ getFunctions()

static Set< NamespacedKey > dev.jorel.commandapi.wrappers.SimpleFunctionWrapper.getFunctions ( )
static

Returns a set of all functions that the server has registered.

Returns
a set of all functions that the server has registered

◆ getKey()

NamespacedKey dev.jorel.commandapi.wrappers.SimpleFunctionWrapper.getKey ( )

Returns the NamespacedKey that uniquely represents this object.

Returns
the NamespacedKey that uniquely represents this object

◆ getTag()

static SimpleFunctionWrapper[] dev.jorel.commandapi.wrappers.SimpleFunctionWrapper.getTag ( NamespacedKey  key)
static

Returns a SimpleFunctionWrapper[], which is an array of all of the functions that this tag contains.

Parameters
keya NamespacedKey representation of the tag. This key should not include a # symbol.
Returns
a SimpleFunctionWrapper[], which is an array of all of the functions that this tag contains

◆ getTags()

static Set< NamespacedKey > dev.jorel.commandapi.wrappers.SimpleFunctionWrapper.getTags ( )
static

Returns a set of all tags that the server has registered.

Returns
a set of all tags that the server has registered

◆ run()

int dev.jorel.commandapi.wrappers.SimpleFunctionWrapper.run ( CommandSender  sender)

Runs this function with a given CommandSender.

Parameters
senderthe sender to use to run this function
Returns
the result of running this command