Got a question that the wiki doesn't answer? Ask on the forum (preferred), or join us on IRC.

About the ads

CommandHelper/Staged/API

From SK's Wiki
Jump to: navigation, search


Command Helper uses a language called MethodScript, which greatly extend the capabilities of the plugin, and make the plugin a fully Turing Complete language. There are several functions defined, and they are grouped into "classes".

Each function has its own page for documentation, where you can view examples for how to use a particular function.

Contents

ArrayHandling

This class contains functions that provide a way to manipulate arrays. To create an array, use the array function. For more detailed information on array usage, see the page on arrays

Function Name Returns Arguments Throws Description Since Restricted
array_contains() boolean array, testValue CastException Checks to see if testValue is in array.
(Examples...)
3.0.1
No
array_contains_ic() boolean array, testValue CastException Works like array_contains, except the comparison ignores case.
(Examples...)
3.3.0
No
array_filter() array array, boolean closure(key, value) CastException Filters an array by callback. The items in the array are iterated over, each one sent to the closure one at a time, as key, value. The closure should return true if the item should be included in the array, or false if not. The filtered array is then returned by the function. If the array is associative, the keys will continue to map to the same values, however a normal array, the values are simply pushed onto the new array, and won't correspond to the same values per se.
(Examples...)
3.3.1
No
array_get() mixed array, index, [default] CastException

IndexOverflowException

Returns the element specified at the index of the array. See More...
(Examples...)
3.0.1
No
array_implode() string array, [glue] CastException Given an array and glue, to-strings all the elements in the array (just the values, not the keys), and joins them with the glue, defaulting to a space. For instance array_implode(array(1, 2, 3), '-') will return "1-2-3".
(Examples...)
3.3.0
No
array_index() mixed array, value CastException Works exactly like array_indexes(array, value)[0], except in the case where the value is not found, returns null. That is to say, if the value is contained in an array (even multiple times) the index of the first element is returned.
(Examples...)
3.3.1
No
array_index_exists() boolean array, index CastException Checks to see if the specified array has an element at index
(Examples...)
3.1.2
No
array_indexes() array array, value CastException Returns an array with all the keys of the specified array at which the specified value is equal. That is, for the array(1, 2, 2, 3), if value were 2, would return array(1, 2). If the value cannot be found in the array at all, an empty array will be returned.
(Examples...)
3.3.1
No
array_insert() void array, item, index CastException

IndexOverflowException

Inserts an item at the specified index, and shifts all other items in the array to the right one. If index is greater than the size of the array, an IndexOverflowException is thrown, though the index may be equal to the size, in which case this works just like array_push. The array must be normal though, associative arrays are not supported.
(Examples...)
3.3.1
No
array_keys() array array CastException Returns the keys in this array as a normal array. If the array passed in is already a normal array, the keys will be 0 -> (array_size(array) - 1)
(Examples...)
3.3.0
No
array_merge() array array1, array2, [arrayN...] InsufficientArgumentsException

CastException

Merges the specified arrays from left to right, and returns a new array. If the array merged is associative, it will overwrite the keys from left to right, but if the arrays are normal, the keys are ignored, and values are simply pushed.
(Examples...)
3.3.0
No
array_normalize() array array CastException Returns a new normal array, given an associative array. (If the array passed in is not associative, a copy of the array is returned).
(Examples...)
3.3.0
No
array_push() void array, value, [value2...] CastException Pushes the specified value(s) onto the end of the array. Unlike calling array_set(@array, array_size(@array), @value) on a normal array, the size of the array is increased first. This will therefore never cause an IndexOverflowException. The special operator syntax @array[] = 'value' is also supported, as shorthand for array_push().
(Examples...)
3.0.1
No
array_rand() array array, [number, [getKeys]] RangeException

CastException

Returns a random selection of keys or values from an array. The array may be either normal or associative. Number defaults to 1, and getKey defaults to true. If number is greater than the size of the array, a RangeException is thrown. No value will be returned twice from the array however, one it is "drawn" from the array, it is not placed back in. The order of the elements in the array will also be random, if order is important, use array_sort().
(Examples...)
3.3.1
No
array_remove() mixed array, index RangeException

CastException
PluginInternalException

Removes an index from an array. If the array is a normal array, all values' indicies are shifted left one. If the array is associative, the index is simply removed. If the index doesn't exist, the array remains unchanged. The value removed is returned.
(Examples...)
3.3.0
No
array_remove_values() void array, value CastException Removes all instances of value from the specified array. For instance, array_remove_values(array(1, 2, 2, 3), 2) would produce the array(1, 3). Note that it returns void however, so it will simply in place modify the array passed in, much like array_remove.
(Examples...)
3.3.1
No
array_resize() array array, size, [fill] CastException Resizes the given array so that it is at least of size size, filling the blank spaces with fill, or null by default. If the size of the array is already at least size, nothing happens; in other words this function can only be used to increase the size of the array. A reference to the array is returned, for easy chaining.
(Examples...)
3.2.0
No
array_reverse() void array CastException Reverses an array in place. However, if the array is associative, throws a CastException, since associative arrays are more like a map.
(Examples...)
3.3.1
No
array_set() void array, index, value CastException

IndexOverflowException

Sets the value of the array at the specified index. array_set(array, index, value). Returns void. If the element at the specified index isn't already set, throws an exception. Use array_push to avoid this.
(Examples...)
3.0.1
No
array_size() int array CastException Returns the size of this array as an integer.
(Examples...)
3.0.1
No
array_sort() array array, [sortType] CastException

FormatException

Sorts an array in place, and also returns a reference to the array. See More...
(Examples...)
3.3.1
No
array_sort_async() void array, [sortType], closure(array) CastException Works like array_sort, but does the sort on another thread, then calls the closure and sends it the sorted array. This is useful if the array is large enough to actually "stall" the server when doing the sort. Sort type should be one of REGULAR, NUMERIC, STRING or STRING_IC 3.3.1
No
array_unique() array array, [compareTypes] CastException Removes all non-unique values from an array. See More...
(Examples...)
3.3.1
No
cslice() slice from, to CastException Dynamically creates an array slice, which can be used with array_get (or the [bracket notation]) to get a range of elements. cslice(0, 5) is equivalent to 0..5 directly in code, however with this function you can also do cslice(@var, @var), or other more complex expressions, which are not possible in static code.
(Examples...)
3.3.1
No
range() array start, finish, [increment]
finish
CastException Returns an array of numbers from start to (finish - 1) skipping increment integers per count. start defaults to 0, and increment defaults to 1. All inputs must be integers. If the input doesn't make sense, it will reasonably degrade, and return an empty array.
(Examples...)
3.2.0
No

BasicLogic

These functions provide basic logical operations.

Function Name Returns Arguments Throws Description Since Restricted
and() boolean var1, [var2...] CastException Returns the boolean value of a logical AND across all arguments. Uses lazy determination, so once an argument returns false, the function returns. Operator syntax is supported: @a && @b
(Examples...)
3.0.1
No
bit_and() int int1, int2, [int3...] CastException

InsufficientArgumentsException

Returns the bitwise AND of the values
(Examples...)
3.3.0
No
bit_not() int int1 CastException Returns the bitwise NOT of the given value
(Examples...)
3.3.0
No
bit_or() int int1, int2, [int3...] CastException

InsufficientArgumentsException

Returns the bitwise OR of the specified values
(Examples...)
3.3.0
No
bit_xor() int int1, int2, [int3...] CastException

InsufficientArgumentsException

Returns the bitwise exclusive OR of the specified values
(Examples...)
3.3.1
No
equals() boolean var1, var2[, varX...] InsufficientArgumentsException Returns true or false if all the arguments are equal. Operator syntax is also supported: @a == @b
(Examples...)
3.0.1
No
equals_ic() boolean val1, val2[, valX...] InsufficientArgumentsException Returns true if all the values are equal to each other, while ignoring case.
(Examples...)
3.2.0
No
gt() boolean var1, var2 CastException Returns the result of a greater than operation. Operator syntax is also supported: @a > @b
(Examples...)
3.0.1
No
gte() boolean var1, var2 CastException Returns the result of a greater than or equal to operation. Operator sytnax is also supported: @a >= @b
(Examples...)
3.0.1
No
if() mixed cond, trueRet, [falseRet] CastException If the first argument evaluates to a true value, the second argument is returned, otherwise the third argument is returned. If there is no third argument, it returns void.
(Examples...)
3.0.1
No
ifelse() mixed [boolean1, code]..., [elseCode] InsufficientArgumentsException Provides a more convenient method for running if/else chains. If none of the conditions are true, and there is no 'else' condition, void is returned.
(Examples...)
3.3.0
No
lshift() int value, bitsToShift CastException Left shifts the value bitsToShift times
(Examples...)
3.3.0
No
lt() boolean var1, var2 CastException Returns the results of a less than operation. Operator syntax is also supported: @a < @b
(Examples...)
3.0.1
No
lte() boolean var1, var2 CastException Returns the result of a less than or equal to operation. Operator syntax is also supported: @a <= @b
(Examples...)
3.0.1
No
nand() boolean val1, [val2...] CastException Return the equivalent of not(and())
(Examples...)
3.3.0
No
nequals() boolean val1, val2 Returns true if the two values are NOT equal, or false otherwise. Equivalent to not(equals(val1, val2)). Operator syntax is also supported: @a != @b
(Examples...)
3.3.0
No
nequals_ic() boolean val1, val2 Returns true if the two values are NOT equal to each other, while ignoring case.
(Examples...)
3.3.0
No
nor() boolean val1, [val2...] CastException Returns the equivalent of not(or())
(Examples...)
3.3.0
No
not() boolean var1 CastException Returns the boolean value of a logical NOT for this argument. Operator syntax is also supported: !@var
(Examples...)
3.0.1
No
or() boolean var1, [var2...] CastException Returns the boolean value of a logical OR across all arguments. Uses lazy determination, so once an argument resolves to true, the function returns. Operator syntax is also supported: @a @b
(Examples...)
3.0.1
No
ref_equals() boolean val1, val2 Returns true if and only if the two values are actually the same reference. Primitives that are equal will always be the same reference, this method is only useful for object/array comparisons.
(Examples...)
3.3.1
No
rshift() int value, bitsToShift CastException Right shifts the value bitsToShift times
(Examples...)
3.3.0
No
sequals() boolean val1, val2 Uses a strict equals check, which determines if two values are not only equal, but also the same type. So, while equals('1', 1) returns true, sequals('1', 1) returns false, because the first one is a string, and the second one is an int. More often than not, you want to use plain equals(). Operator syntax is also supportd: @a === @b
(Examples...)
3.3.0
No
snequals() boolean val1, val2 Equivalent to not(sequals(val1, val2)). Operator syntax is also supported: @a !== @b
(Examples...)
3.3.1
No
switch() mixed value, [equals, code]..., [defaultCode] InsufficientArgumentsException Provides a switch statement. If none of the conditions match, and no default is provided, void is returned. See the documentation on Logic for more information. See More...
(Examples...)
3.3.0
No
urshift() int value, bitsToShift CastException Right shifts value bitsToShift times, pushing a 0, making this an unsigned right shift.
(Examples...)
3.3.0
No
xnor() boolean val1, val2 CastException Returns the xnor of the two values
(Examples...)
3.3.0
No
xor() boolean val1, val2 CastException Returns the xor of the two values.
(Examples...)
3.3.0
No

ByteArrays

This class contains all the methods needed to manipulate a byte array primitive. Since byte arrays would be very inefficient to implement using a normal array, this data type allows for more efficient operations, while still allowing for low level data access. Most data transferred within scripts is higher level, and does not require access to a byte array, however, code that interacts with external processes may require use of these functions to properly manipulate the data. Note that all the methods deal with low level types, so the following definitions apply: a byte is 8 bits, a short is 16 bits, an int is 32 bits, a long is 64 bits. UTF-8 strings are supported directly. The byte array is automatically resized as needed.

Function Name Returns Arguments Throws Description Since Restricted
ba_as_array() array byte_array CastException Returns a new read only copy of the underlying byte array. This array is much more efficient than if the array were made manually, however, it is read only. If you need to manipulate the array's contents, then you can clone the array, however, the returned array (and any clones) cannot be automatically interfaced with the byte array primitives. This operation is discouraged, because normal arrays are very inefficient for dealing with low level bit data. 3.3.1
No
ba_get_byte() int byte_array, [pos] CastException

RangeException

Returns an int, read in as an 8 bit byte, from the given position, or wherever the marker is currently at by default. 3.3.1
No
ba_get_bytes() byte_array byte_array, length, [pos] CastException

RangeException

Returns a new byte_array primitive, starting from pos (or wherever the marker is by default) to length. 3.3.1
No
ba_get_char() string byte_array, [pos] CastException

RangeException

Returns a one character string, read in as an 32 bit char, from the given position, or wherever the marker is currently at by default. 3.3.1
No
ba_get_double() double byte_array, [pos] CastException

RangeException

Returns a double, read in as a 64 bit double, from the given position, or wherever the marker is currently at by default. 3.3.1
No
ba_get_float() double byte_array, [pos] CastException

RangeException

Returns a double, read in as a 32 bit float, from the given position, or wherever the marker is currently at by default. 3.3.1
No
ba_get_int() int byte_array, [pos] CastException

RangeException

Returns an int, read in as a 32 bit int, from the given position, or wherever the marker is currently at by default. 3.3.1
No
ba_get_long() int byte_array, [pos] CastException

RangeException

Returns an int, read in as a 64 bit long, from the given position, or wherever the marker is currently at by default. 3.3.1
No
ba_get_short() int byte_array, [pos] CastException

RangeException

Returns an int, read in as a 16 bit short, from the given position, or wherever the marker is currently at by default. 3.3.1
No
ba_get_string() string byte_array, [pos], [encoding] CastException

RangeException

Returns a UTF-8 encoded string, from the given position, or wherever the marker is currently at by default. The string is assumed to have encoded the length of the string with a 32 bit integer, then the string bytes. (This will be the case is the byte_array was encoded with ba_set_string.) The encoding of the string may be set, but defaults to UTF-8. 3.3.1
No
ba_put_byte() void byte_array, int, [pos] CastException Writes an int, interpreted as an 8 bit byte, starting from the given position, or wherever the marker is currently at by default. 3.3.1
No
ba_put_bytes() void destination_byte_array, source_byte_array, [pos] CastException Writes the contents of the source_byte_array into this byte array, starting at pos, or wherever the marker is currently at by default. 3.3.1
No
ba_put_char() void byte_array, string, [pos] CastException Writes the first character of the string, interpreted as an 32 bit char, starting from the given position, or wherever the marker is currently at by default. If the string is empty, a \0 is written instead. 3.3.1
No
ba_put_double() void byte_array, double, [pos] CastException Writes a double, interpreted as a 64 bit double, starting from the given position, or wherever the marker is currently at by default. 3.3.1
No
ba_put_float() void byte_array, double, [pos] CastException Writes a double, interpreted as a 32 bit float, starting from the given position, or wherever the marker is currently at by default. 3.3.1
No
ba_put_int() void byte_array, int, [pos] CastException Writes an int, interpreted as a 32 bit int, starting from the given position, or wherever the marker is currently at by default. 3.3.1
No
ba_put_long() void byte_array, int, [pos] CastException Writes an int, interpreted as a 64 bit, starting from the given position, or wherever the marker is currently at by default. 3.3.1
No
ba_put_short() void byte_array, int, [pos] CastException Writes an int, interpreted as an 16 bit short, starting from the given position, or wherever the marker is currently at by default. 3.3.1
No
ba_put_string() void byte_array, string, [pos], [encoding] CastException Writes the length of the string to the byte array, as a short, (interpreted as UTF-8), then writes the UTF-8 string itself. If an external application requires the string to be serialized in a different manner, then use the string-byte_array conversion methods in StringHandling, however strings written in this manner are compatible with ba_get_string. The encoding may be set, but defaults to UTF-8. 3.3.1
No
ba_rewind() void byte_array CastException Rewinds the byte array marker to 0. 3.3.1
No
byte_array() byte_array Returns a new byte array primitive, which can be operated on with the ba_ series of functions. 3.3.1
No

Cmdline

This class contains functions that are mostly only useful for command line scripts, but in general may be used by any script. For more information on running MethodScript from the command line, see this wiki page.

Function Name Returns Arguments Throws Description Since Restricted
cd() void [dir] IOException

InsufficientPermissionException

Changes the current working directory to the path specified, or the user's home directory if omitted. This only works from cmdline mode. 3.3.1
Yes
clear_screen() void Clears the screen. This only works from cmdline mode, nothing happens otherwise. 3.3.1
Yes
exit() void [int] Exits the program. If this is being run from the command line, works by exiting the interpreter, with the specified exit code (defaulting to 0). If this is being run from in-game, works just like die().
(Examples...)
3.3.1
No
get_env() mixed [variableName] Returns the environment variable specified, if variableName is set. Otherwise, returns an associative array of all the environment variables. 3.3.1
Yes
get_terminal_width() int Returns the current width of the terminal, measured in characters. This is useful for determining proper layout for dynamic output. This only works in cmdline mode. 3.3.1
Yes
ls() array [directory] InsufficientPermissionException Returns an array of files in the current working directory, including "hidden" files, orif directory is specified, the files in that directory. This is only available in cmdline mode. 3.3.1
Yes
prompt_char() string prompt InsufficientPermissionException

IOException

Prompts the user for a single character. They do not need to hit enter first. This only works in cmdline mode. 3.3.1
Yes
prompt_line() string prompt InsufficientPermissionException

IOException

Prompts the user for a line. The line typed is returned once the user presses enter. This only works in cmdline mode. 3.3.1
Yes
prompt_pass() string prompt, [mask] InsufficientPermissionException

IOException

Prompts the user for a password. This only works in cmdline mode. If mask is true (default), then the password displays * characters for each password character they type. If mask is false, the field stays blank as they type. What they type is returned once they hit enter. 3.3.1
Yes
pwd() string Returns the path to the current working directory. This is available outside cmdline mode, but is probably only useful for debugging, meta, or informational purposes when not in cmdline interpreter mode, as the current working directory is known simply by knowing what file this is running from. 3.3.1
Yes
read_pipe_input() mixed [binary] IOException

InsufficientPermissionException

Reads the input from a process that is piped to this script. It is assumed that the data piped to the script will come all at once, and it will be returned as a string (or byte_array if binary is true). This can only be used in cmdline mode, and binary defaults to false. If the script isn't started in TTY mode, an IOException is thrown. 3.3.1
Yes
set_cmdline_prompt() void closure CastException

InsufficientPermissionException

Sets the cmdline prompt. This is only usable or useful in cmdline interpreter mode. The closure should return a string, that string will be used as the prompt. The closure is called each time a prompt needs generating, thereby allowing for dynamic prompts. 3.3.1
Yes
set_env() void variableName, value Sets the value of an environment variable. This only changes the environment value in this process, not system-wide. This uses some hackery to work, and may not be 100% reliable in all cases, and shouldn't be relied on heavily. It will always work with get_env, however, so you can rely on that mechanism. The value will always be interpreted as a string, so if you are expecting a particular data type on a call to get_env, you will need to manually cast the variable. Arrays will be toString'd as well, but will be accepted. 3.3.1
Yes
shell() string command, [options] InsufficientPermissionException

ShellException
IOException

Runs a shell command. command can be either a string, or array of string arguments. This works mostly like shell_adv() however, it buffers then returns the output for sysout once the process is completed, and throws a ShellException with the exception message set to the syserr output if the process exits with an exit code that isn't the expectedExitCode, which defaults to 0. This is useful for simple commands that return output and don't need very complicated usage, and failures don't need to check the exact error code. If the underlying command throws an IOException, it is passed through. Requires the allow-shell-commands option to be enabled in preferences, or run from command line, otherwise an InsufficientPermissionException is thrown. Options is an associative array which expects zero or more of the following options: expectedErrorCode - The expected error code indicating successful command completion. Defaults to 0. workingDir - Sets the working directory for the sub process. By default null, which represents the directory of this script. If the path is relative, it is relative to the directory of this script.
(Examples...)
3.3.1
Yes
shell_adv() void command, [options] InsufficientPermissionException

IOException

Runs a shell command. command can either be a string or an array of string arguments, which are run as an external process. Requires the allow-shell-commands option to be enabled in preferences, or run from command line, otherwise an InsufficientPermissionException is thrown. See More... 3.3.1
Yes
sys_beep() void InsufficientPermissionException

PluginInternalException

Emits a system beep, on the system itself, not in game. This is only useful from cmdline. 3.3.1
Yes
sys_err() void text Writes the text to the system's std err. Unlike console(), this does not use anything else to format the output, though in many cases they will behave nearly the same. However, colors and other formatting characters will not "bleed" through, so sys_err(color(RED) . 'This is red') will not cause the next line to also be red, so if you need to print multiple lines out, you should manually add \n to create your linebreaks, and only make one call to sys_err.
(Examples...)
3.3.1
Yes
sys_out() void text Writes the text to the system's std out. Unlike console(), this does not use anything else to format the output, though in many cases they will behave the same. However, colors and other formatting characters will not "bleed" through, so sys_out(color(RED) . 'This is red') will not cause the next line to also be red, so if you need to print multiple lines out, you should manually add \n to create your linebreaks, and only make one call to sys_out.
(Examples...)
3.3.1
Yes
sys_properties() mixed [propertyName] If propertyName is set, that single property is returned, or null if that property doesn't exist. If propertyName is not set, an associative array with all the system properties is returned. This mechanism hooks into Java's system property mechanism, and is just a wrapper for that. System properties are more reliable than environmental variables, and so are preferred in cases where they exist. For more information about system properties, see http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html. In addition, known preferences listed in preferences.ini are also included, starting with the prefix "methodscript.preference."
(Examples...)
3.3.1
Yes

Commands

A series of functions for creating and managing custom commands.

Function Name Returns Arguments Throws Description Since Restricted
register_command() boolean commandname, optionsArray FormatException Registers a command to the server's command list, or updates an existing one. Options is an associative array that can have the following keys: description, usage, permission, noPermMsg, aliases, tabcompleter, and/or executor. Everything is optional and can be modified later, except for 'aliases' due to how Bukkit's command map works. 'noPermMsg' is the message displayed when the user doesn't have the permission specified in 'permission'. 'Usage' is the message shown when the 'executor' returns false. 'Executor' is the closure run when the command is executed, and can return true or false (by default is treated as true). 'tabcompleter' is the closure run when a user hits tab while the command is entered and ready for args. It is meant to return an array of completions, but if not the tab_complete_command event will be fired, and the completions of that event will be sent to the user. Both executor and tabcompleter closures are passed the following information in this order: alias used, name of the sender, array of arguments used, array of command info. 3.3.1
Yes
set_executor() void commandname, closure FormatException

NotFoundException

Sets the code that will be run when a user attempts to execute a command. The closure can return true false (treated as true by default). Returning false will display The usage message if it is set. The closure is passed the following information in this order: alias used, name of the sender, array of arguments used, array of command info. 3.3.1
Yes
set_tabcompleter() void commandname, closure FormatException

NotFoundException

Sets the code that will be run when a user attempts to tabcomplete a command. The closure is expected to return an array of completions, otherwise the tab_complete_command event will be fired and used to send completions. The closure is passed the following information in this order: alias used, name of the sender, array of arguments used, array of command info. 3.3.1
Yes
unregister_command() boolean commandname NotFoundException unregisters a command from the server's command list 3.3.1
Yes

Crypto

Provides common cryptographic functions

Function Name Returns Arguments Throws Description Since Restricted
base64_decode() byte_array base64data CastException Decodes the base 64 encoded byte_array data back into the original byte_array data.
(Examples...)
3.3.1
No
base64_encode() byte_array byteData CastException Encodes the given byte_array data into a base 64 byte_array.
(Examples...)
3.3.1
No
bcrypt() string val, [workload] CastException

RangeException

Encrypts a value using bcrypt, using the specified workload, or 5 if none provided. BCrypt is supposedly more secure than SHA1, and certainly more secure than md5. Note that using bcrypt is slower, which is one of its security advantages, however, setting the workload to higher numbers will take exponentially more time. A workload of 5 is a moderate operation, which should complete in under a second, however, setting it to 10 will take many seconds, and setting it to 15 will take a few minutes. The workload must be between 5 and 31. See the documentation for check_bcrypt for full usage.
(Examples...)
3.3.1
No
check_bcrypt() boolean plaintext, hash Checks to see if this plaintext password does in fact hash to the hash specified. Unlike md5 or sha1, simply comparing hashes won't work. Consider the following usage: assign(@plain, 'plaintext') assign(@hash, bcrypt(@plain)) msg(if(check_bcrypt(@plain, @hash), 'They match!', 'They do not match!'))
(Examples...)
3.3.1
No
md5() string val PluginInternalException Returns the md5 hash of the specified string. The md5 hash is no longer considered secure, so you should not use it for storage of sensitive data, however for general hashing, it is a quick and easy solution. md5 is a one way hashing algorithm.
(Examples...)
3.3.0
No
rot13() string val Returns the rot13 version of val. Note that rot13(rot13(val)) returns val
(Examples...)
3.3.0
No
sha1() string val PluginInternalException Returns the sha1 hash of the specified string. Note that sha1 is considered more secure than md5, and is typically used when storing sensitive data. It is a one way hashing algorithm.
(Examples...)
3.3.0
No
sha256() string val PluginInternalException Returns the sha256 hash of the specified string. Note that sha256 is considered more secure than sha1 and md5, and is typically used when storing sensitive data. It is a one way hashing algorithm.
(Examples...)
3.3.1
No

DataHandling

This class provides various methods to control script data and program flow.

Function Name Returns Arguments Throws Description Since Restricted
array() array [var1, [var2...]] Creates an array of values.
(Examples...)
3.0.1
No
assign() ivariable ivar, mixed CastException Accepts an ivariable ivar as a parameter, and puts the specified value mixed in it. Returns the variable that was assigned. Operator syntax is also supported: @a = 5;. Other Other forms are supported as well, +=, -=, *=, /=, .=, which do multiple operations at once. Array assigns are also supported: @array[5] = 'new value in index 5';
(Examples...)
3.0.1
No
associative_array() array [args...] Works exactly like array(), except the array created will be an associative array, even if the array has been created with no elements. This is the only use case where this is neccessary, vs using the normal array() function, or in the case where you assign sequential keys anyways, and the same array could have been created using array().
(Examples...)
3.3.1
No
boolean() boolean item Returns a new construct that has been cast to a boolean. The item is cast according to the boolean conversion rules. Since all data types can be cast to a a boolean, this function will never throw an exception.
(Examples...)
3.3.0
No
break() nothing [int] CastException Stops the current loop. If int is specified, and is greater than 1, the break travels that many loops up. So, if you had a loop embedded in a loop, and you wanted to break in both loops, you would call break(2). If this function is called outside a loop (or the number specified would cause the break to travel up further than any loops are defined), the function will fail. If no argument is specified, it is the same as calling break(1). This function has special compilation rules. The break number must not be dynamic, or a compile error will occur. An integer must be hard coded into the function.
(Examples...)
3.1.0
No
call_proc() mixed proc_name, [var1...] InvalidProcedureException Dynamically calls a user defined procedure. call_proc(_myProc, 'var1') is the equivalent of _myProc('var1'), except you could dynamically build the procedure name if need be. This is useful for dynamic coding, however, closures work best for callbacks. Throws an InvalidProcedureException if the procedure isn't defined. If you are hardcoding the first parameter, a warning will be issued, because it is much more efficient and safe to directly use a procedure if you know what its name is beforehand. 3.2.0
Yes
call_proc_array() mixed proc_name, array InvalidProcedureException

CastException

Works like call_proc, but allows for variable or unknown number of arguments to be passed to a proc. The array parameter is "flattened", and call_proc is essentially called. If the array is associative, an exception is thrown. 3.3.1
Yes
closure() closure [varNames...,] code Returns a closure on the provided code. A closure is a datatype that represents some code as code, not the results of some code after it is run. Code placed in a closure can be used as a string, or executed by other functions using the eval() function. If a closure is "to string'd" it will not necessarily look like the original code, but will be functionally equivalent. The current environment is "snapshotted" and stored with the closure, however, this information is only stored in memory, it isn't retained during a serialization operation. Also, the special variable @arguments is automatically created for you, and contains an array of all the arguments passed to the closure, much like procedures. See the wiki article on closures for more details and examples. 3.3.0
Yes
continue() void [int] CastException Skips the rest of the code in this loop, and starts the loop over, with it continuing at the next index. If this function is called outside of a loop, the command will fail. If int is set, it will skip 'int' repetitions. If no argument is specified, 1 is used.
(Examples...)
3.1.0
No
double() double item CastException Returns a new construct that has been cast to an double. This function will throw a CastException if is_numeric would return false for this item, but otherwise, it will be cast properly.
(Examples...)
3.3.0
No
dowhile() void code, condition Like while, but always runs the code at least once. The condition is checked after each run of the code, and if it is true, the code is run again. break and continue work inside a dowhile, but continuing more than once is pointless, since the loop isn't inherently keeping track of any counters anyways. Breaking multiple times still works however.
(Examples...)
3.3.1
No
execute() mixed [values...,] closure CastException Executes the given closure. You can also send arguments to the closure, which it may or may not use, depending on the particular closure's definition. If the closure returns a value with return(), then that value will be returned with execute. Otherwise, void is returned. 3.3.1
Yes
export() void ivar
key, value
InsufficientArgumentsException Stores a value in the global storage register. When using the first mode, the ivariable is stored so it can be imported later, and when using the second mode, an arbitrary value is stored with the give key, and can be retreived using the secode mode of import. The first mode will be deprecated in future versions, so should be avoided. If the value is already stored, it is overwritten. See import() and importing/exporting. The reference to the value is stored, not a copy of the value, so in the case of arrays, manipulating the contents of the array will manipulate the stored value.
(Examples...)
3.3.0
Yes
for() void assign, condition, expression1, expression2 CastException Acts as a typical for loop. The assignment is first run. Then, a condition is checked. If that condition is checked and returns true, expression2 is run. After that, expression1 is run. In java syntax, this would be: for(assign; condition; expression1){expression2}. assign must be an ivariable, either a pre defined one, or the results of the assign() function. condition must be a boolean.
(Examples...)
3.0.1
No
foreach() void array, [key], ivar, code CastException

RangeException

Walks through array, setting ivar equal to each element in the array, then running code. In addition, foreach(1..4, @i, code()) is also valid, setting @i to 1, 2, 3, 4 each time. The same syntax is valid as in an array slice. If key is set (it must be an ivariable) then the index of each iteration will be set to that. See the examples for a demonstration. See More...
(Examples...)
3.0.1
No
foreachelse() void array, ivar, code, else CastException

RangeException

Works like a foreach, except if the array is empty, the else code runs instead. That is, if the code would not run at all, the else condition would. In general, brace syntax and use of foreach(){ } else { } syntax is preferred, instead of using foreachelse directly.
(Examples...)
3.3.1
No
forelse() void assign, condition, expression1, expression2, else Works like a normal for, but if upon checking the condition the first time, it is determined that it is false (that is, NO code loops are going to be run) the else code is run instead. If the loop runs, even once, it will NOT run the else branch. 3.3.1
No
import() mixed ivar
key
This function imports a value from the global value register. In the first mode, it looks for an ivariable with the specified name, and stores the value in the variable, and returns void. The first mode is deprecated, and should not be used. In the second mode, it looks for a value stored with the specified key, and returns that value. Items can be stored with the export function. If the specified ivar doesn't exist, the ivar will be assigned an empty string, and if the specified string key doesn't exist, null is returned. See the documentation on imports/exports for more information.
(Examples...)
3.3.0
Yes
include() void path IncludeException Includes external code at the specified path. 3.2.0
Yes
integer() integer item CastException Returns a new construct that has been cast to an integer. This function will throw a CastException if is_numeric would return false for this item, but otherwise, it will be cast properly. Data may be lost in this conversion. For instance, 4.5 will be converted to 4, by using integer truncation. You can use is_integral to see if this data loss would occur.
(Examples...)
3.3.0
No
is_array() boolean item Returns whether or not the item is an array
(Examples...)
3.1.2
No
is_associative() boolean array CastException Returns whether or not the array is associative. If the parameter is not an array, throws a CastException.
(Examples...)
3.3.0
No
is_boolean() boolean item Returns whether the given item is of the boolean datatype. Note that all datatypes can be used as booleans, however this function checks the specific datatype of the given item.
(Examples...)
3.1.2
No
is_bytearray() boolean item Returns whether or not the item is actually a ByteArray datatype.
(Examples...)
3.3.1
No
is_closure() boolean arg Returns true if the argument is a closure (could be executed) or false otherwise
(Examples...)
3.3.1
No
is_double() boolean item Returns whether or not the given item is a double. Note that numeric strings and integers can usually be used as a double, however this function checks the actual datatype of the item. If you just want to see if an item can be used as a number, use is_numeric() instead.
(Examples...)
3.1.2
No
is_integer() boolean item Returns whether or not the given item is an integer. Note that numeric strings can usually be used as integers, however this function checks the actual datatype of the item. If you just want to see if an item can be used as a number, use is_integral() or is_numeric() instead.
(Examples...)
3.1.2
No
is_integral() boolean item CastException Returns true if the numeric value represented by a given double or numeric string could be cast to an integer without losing data (or if it's an integer). For instance, is_numeric(4.5) would return true, and integer(4.5) would work, however, equals(4.5, integer(4.5)) returns false, because the value was narrowed to 4.
(Examples...)
3.3.0
No
is_null() boolean item Returns whether or not the given item is null.
(Examples...)
3.1.2
No
is_numeric() boolean item Returns false if the item would fail if it were used as a numeric value. If it can be parsed or otherwise converted into a numeric value, true is returned.
(Examples...)
3.3.0
No
is_proc() boolean procName Returns whether or not the given procName is currently defined, i.e. if calling this proc wouldn't throw an exception. 3.2.0
Yes
is_string() boolean item Returns whether or not the item is actually a string datatype. If you just care if some data can be used as a string, use is_stringable().
(Examples...)
3.3.1
No
is_stringable() boolean item Returns whether or not the item is convertable to a string. Everything but arrays can be used as strings.
(Examples...)
3.3.1
No
parse_int() int value, radix CastException

RangeException
FormatException

Converts a string representation of an integer to a real integer, given the value's radix (base). See to_radix() for a more detailed explanation of number theory. Radix must be between 2 and 36, inclusive.
(Examples...)
3.3.1
No
proc() void [name], [ivar...], procCode FormatException Creates a new user defined procedure (also known as "function") that can be called later in code. Please see the more detailed documentation on procedures for more information. 3.1.3
No
return() nothing mixed Returns the specified value from this procedure. It cannot be called outside a procedure. 3.2.0
No
string() string item Creates a new construct that is the "toString" of an item. For arrays, an human readable version is returned; this should not be used directly, as the format is not guaranteed to remain consistent. Booleans return "true" or "false" and null returns "null".
(Examples...)
3.3.0
No
to_radix() string value, radix CastException

RangeException
FormatException

Given an int and a radix, returns a string representation of the integer value in the given base. A common use would be to output a hex or binary representation of a number, for instance. See More...
(Examples...)
3.3.1
No
typeof() string arg Returns a string value of the typeof a value. For instance 'array' is returned for typeof(array()). This is a generic replacement for the is_* series of functions.
(Examples...)
3.3.1
No
while() void condition, [code] While the condition is true, the code is executed. break and continue work inside a dowhile, but continuing more than once is pointless, since the loop isn't inherently keeping track of any counters anyways. Breaking multiple times still works however.
(Examples...)
3.3.1
No

DataTransformations

This class provides functions that are able to transform data from native objects to their serialized forms, i.e. json, ini, etc.

Function Name Returns Arguments Throws Description Since Restricted
ini_decode() array string FormatException Returns an array, given an INI format input. INI files are loosely defined as a set of key->value pairs, which lends itself to an associative array format. Key value pairs are denoted usually by a key=value format. The specific rules for decoding an INI file can be found here. An associative array is returned. All values are stored as strings, so if 1 was stored, it will be returned as a string '1'. This is a limitation of the ini format, as it is expected that the code that reads the ini knows what the type of the data is anticipated, not the data itself. You can easily cast data that is expected to be numeric via the integer() and float() functions when reading in the data if exact types are truly needed. INI doesn't easily support non-string values, if that is needed, consider using json_encode()/json_decode() instead. 3.3.1
No
ini_encode() string array, [comment] FormatException

CastException

Encodes an array into an INI format output. An associative array is expected, and a format exception is thrown if it is a normal array. The comment is optional, but if provided will be added to the header of the returned string. Inner arrays cannot be stored, and will throw a CastException if attempted. Nulls are encoded as an empty string, so when reading the value back in, the difference between and null is lost. All values are stored as strings, so if 1 is stored, it will be returned as a string '1'. This is a limitation of the ini format, as it is expected that the code that reads the ini knows what the type of the data is anticipated, not the data itself. 3.3.1
No
json_decode() array string FormatException Takes a JSON encoded string, and returns an array, either normal or associative, depending on the contents of the JSON string. If the JSON string is improperly formatted, a FormatException is thrown. 3.3.1
No
json_encode() string array CastException Converts an array into a JSON encoded string. Both normal and associative arrays are supported. Within the array, only primitives and arrays can be encoded. 3.3.1
No
xml_read() mixed xml, xpath FormatException Reads a field from some xml using an XPath address. The XPath address is assumed to be absolute, even if it doesn't start with a '/'. 3.3.1
No
yml_decode() array string FormatException Takes a YML encoded string, and returns an associative array, depending on the contents of the YML string. If the YML string is improperly formatted, a FormatException is thrown. 3.3.1
No
yml_encode() string array, [prettyPrint] CastException Converts an array into a YML encoded string. Only associative arrays are supported. prettyPrint defaults to false. Within the array, only primitives and arrays can be encoded. 3.3.1
No

Debug

Provides methods for viewing data about both CommandHelper and the other plugins in your server. Though not meant to be called by normal scripts, these methods are available everywhere other methods are available. Note that for some of these functions to even work, play-dirty mode must set to on. These are most useful in conjuction with interpreter mode.

Function Name Returns Arguments Throws Description Since Restricted
debug() void message IOException Manually logs a timestamped message to the debug log and the console, if debug-mode is set to true in the preferences 3.3.0
Yes
dump_threads() array Returns an array of all thread names that are currently running in the JVM. This is a debugging tool for your server, and less of a CommandHelper specific thing. 3.3.1
Yes
heap_dump() void PluginInternalException Creates a heap dump file, and places it in the working directory, as "dump.bin". This might throw a PluginInternalException if the heap dump tools aren't available in your JVM. Once dumped, the heap dump can be analyzed using tools such as jhat. More information about jhat can be found here. 3.3.1
Yes
trace() void ivar CastException If debug mode is on, outputs debug information about a variable. Unlike debug, this only accepts an ivar; it is a meta function. The runtime will then take the variable, and output information about it, in a human readable format, including the variable's name and value. If debug mode is off, the function is ignored. 3.3.1
Yes

Echoes

These functions allow you to echo information to the screen

Function Name Returns Arguments Throws Description Since Restricted
broadcast() void message, [permission] NullPointerException Broadcasts a message to all players on the server. If permission is given, only players with that permission will see the broadcast. 3.0.1
Yes
chat() void string PlayerOfflineException Echoes string to the chat, as if the user simply typed something into the chat bar. This function cannot be run from console, a PlayerOfflineException is thrown if attempted. Use broadcast() instead. 3.0.1
Yes
chatas() void player, msg PlayerOfflineException Sends a chat message to the server, as the given player. Otherwise the same as the chat function 3.0.2
Yes
color() string name Returns the color modifier given a color name. If the given color name isn't valid, white is used instead. The list of valid colors is: BLACK, DARK_BLUE, DARK_GREEN, DARK_AQUA, DARK_RED, DARK_PURPLE, GOLD, GRAY, DARK_GRAY, BLUE, GREEN, AQUA, RED, LIGHT_PURPLE, YELLOW, WHITE, RANDOM, BOLD, STRIKETHROUGH, UNDERLINE, ITALIC, or PLAIN_WHITE, in addition the integers 0-15 will work, or the hex numbers from 0-F, and k, l, m, n, o, and r, which represent styles. Unlike manually putting in the color symbol, using this function will return the platform's color code, so if you are wanting to keep your scripts platform independant, it is a much better idea to use this function as opposed to hard coding your own color codes. 3.0.1
Yes
colorize() mixed text, [symbol] Replaces all the colorizable text in the string. For instance, colorize('&aText') would be equivalent to (color('a').'Text'). By default, the symbol is '&', but that can be any arbitrary string that you specify. If text is not a string, that value is simply returned. If you need to "escape" a symbol, (that is have a literal symbol followed by a letter that is a valid color) just repeat the symbol twice, for instance '&&c' would return a literal '&c' instead of a red modifier. 3.3.1
Yes
console() void message, [prefix] CastException Logs a message to the console. If prefix is true, prepends "CommandHelper:" to the message. Default is true. 3.0.2
Yes
die() nothing [var1, var2...,] Kills the command immediately, without completing it. A message is optional, but if provided, displayed to the user. 3.0.1
No
msg() void var1, [var2...] PlayerOfflineException Echoes a message to the player running the command 3.0.1
No
strip_colors() string toStrip Strips all the color codes from a given string 3.3.0
No
tmsg() void player, msg, [...] PlayerOfflineException

InsufficientArgumentsException

Displays a message on the specified players screen, similar to msg, but targets a specific user. 3.0.1
Yes

Economy

Provides functions to hook into the server's economy plugin. To use any of these functions, you must have one of the following economy plugins installed: iConomy 4,5,6, BOSEconomy 6 & 7, EssentialsEcon, 3Co, MultiCurrency, MineConomy, eWallet, EconXP, CurrencyCore, CraftConomy. In addition, you must download the Vault plugin. Beyond this, there is no special setup to get the economy functions working, assuming they work for you in game using the plugin's default controls. Bank controls may not be supported in your particular plugin, check the details of that particular plugin.

Function Name Returns Arguments Throws Description Since Restricted
acc_add() void account_name, to_add PluginInternalException

InvalidPluginException
CastException

Adds an amount to the specified account 3.2.0
Yes
acc_balance() double account_name PluginInternalException

InvalidPluginException

Returns the balance of the given account name. 3.2.0
Yes
acc_divide() void account_name, to_divide PluginInternalException

InvalidPluginException
CastException

Divides the account by the given amount 3.2.0
Yes
acc_multiply() void account_name, to_multiply PluginInternalException

InvalidPluginException
CastException

Multiplies the account balance by the given amount 3.2.0
Yes
acc_remove() void account_name PluginInternalException

InvalidPluginException

Removes the specified account from the game - Currently unimplemented, due to lack of support in Vault. Calling this function will currently always throw an exception. 3.2.0
Yes
acc_set() void account_name, value PluginInternalException

InvalidPluginException
CastException

Sets the account's balance to the given amount 3.2.0
Yes
acc_subtract() void account_name, to_subtract PluginInternalException

InvalidPluginException
CastException

Subtracts the given amount from the specified account 3.2.0
Yes
bacc_add() void bank_name, value PluginInternalException

InvalidPluginException
CastException

Adds the specified amount to the bank account's balance 3.2.0
Yes
bacc_balance() void bank_name PluginInternalException

InvalidPluginException

Gets the specified bank account's balance 3.2.0
Yes
bacc_divide() void bank_name, value PluginInternalException

InvalidPluginException
CastException

Divides the bank account's balance by the given value 3.2.0
Yes
bacc_multiply() void bank_name, value PluginInternalException

InvalidPluginException
CastException

Multiplies the given bank account's balance by the given value 3.2.0
Yes
bacc_remove() void bank_name PluginInternalException

InvalidPluginException

Removes the given bank account from the game 3.2.0
Yes
bacc_set() void bank_name, value PluginInternalException

InvalidPluginException
CastException

Sets the bank account's balance to the given amount 3.2.0
Yes
bacc_subtract() void bank_name, value PluginInternalException

InvalidPluginException
CastException

Subtracts the specified amount from the bank account's balance 3.2.0
Yes

Enchantments

Provides methods for dealing with enchanted items

Function Name Returns Arguments Throws Description Since Restricted
can_enchant_target() boolean name, targetItem EnchantmentException

CastException

Given an enchantment name, and target item id, returns wether or not that item can be enchanted with that enchantment. Throws an EnchantmentException if the name is not a valid enchantment type. 3.3.0
No
enchant_inv() void [player], slot, type, level CastException

EnchantmentException
PlayerOfflineException

Adds an enchantment to an item in the player's inventory. Type can be a single string, or an array of enchantment names. If slot is null, the currently selected slot is used. If the enchantment cannot be applied to the specified item, an EnchantmentException is thrown, and if the level specified is not valid, a RangeException is thrown. If type is an array, level must also be an array, with equal number of values in it, with each int corresponding to the appropriate type. You may use either the bukkit names for enchantments, or the name shown on the wiki: [1], and level may be a roman numeral as well. 3.3.0
Yes
enchant_rm_inv() void [player], slot, type CastException

EnchantmentException
PlayerOfflineException

Removes an enchantment from an item. type may be a valid enchantment, or an array of enchantment names. It can also be null, and all enchantments will be removed. If an enchantment is specified, and the item is not enchanted with that, it is simply ignored. 3.3.0
Yes
enchantment_list() array Returns an informational list of all valid enchantment names. Note that this will simply cover all enchantment types, but may not be a comprehensive list of names that can be accepted, there may be more, however, the list returned here is "comprehensive" and "official". Additionally, this may vary from server type to server type. 3.3.1
No
get_enchant_inv() array [player], slot PlayerOfflineException

CastException

Returns an array of arrays of the enchantments and their levels on the given item. For example: array(array(DAMAGE_ALL, DAMAGE_UNDEAD), array(1, 2)) 3.3.0
Yes
get_enchant_max() int name EnchantmentException Given an enchantment name, returns the max level it can be. If name is not a valid enchantment, an EnchantException is thrown. 3.3.0
No
get_enchants() array item CastException Given an item id, returns the enchantments that can be validly added to this item. This may return an empty array. 3.3.0
No
is_enchantment() boolean name Returns true if this name is a valid enchantment type. Note that either the bukkit names or the wiki names are valid. 3.3.0
No

EntityManagement

This class of functions allow entities to be managed.

Function Name Returns Arguments Throws Description Since Restricted
all_entities() array [world, [x, z]]
[locationArray]
InvalidWorldException

FormatException
CastException

Returns an array of IDs for all entities in the given scope. With no args, this will return all entities loaded on the entire server. If the first argument is given and is a location, only entities in the chunk containin that location will be returned, or if it is a world only entities in that world will be returned. If all three arguments are given, only entities in the chunk with those coords will be returned. This can take chunk coords (ints) or location coords (doubles).
(Examples...)
3.3.1
Yes
can_pickup_items() boolean entityID CastException

BadEntityException

Returns whether the specified living entity can pick up items. 3.3.1
Yes
damage_entity() void entityId, amount CastException

BadEntityTypeException
BadEntityException

Damage an entity 3.3.1
Yes
entities_in_radius() array location array, distance, [type]
location array, distance, [arrayTypes]
CastException

BadEntityException
FormatException

Returns an array of all entities within the given radius. Set type argument to filter entities to a specific type. You can pass an array of types. Valid types (case doesn't matter): DROPPED_ITEM, EXPERIENCE_ORB, PAINTING, ARROW, SNOWBALL, FIREBALL, SMALL_FIREBALL, ITEM_FRAME, WITHER_SKULL, WITHER, BAT, WITCH, ENDER_PEARL, ENDER_SIGNAL, THROWN_EXP_BOTTLE, PRIMED_TNT, FALLING_BLOCK, MINECART, BOAT, CREEPER, SKELETON, SPIDER, GIANT, ZOMBIE, SLIME, GHAST, PIG_ZOMBIE, ENDERMAN, CAVE_SPIDER, SILVERFISH, BLAZE, MAGMA_CUBE, ENDER_DRAGON, PIG, SHEEP, COW, CHICKEN, SQUID, WOLF, MUSHROOM_COW, SNOWMAN, OCELOT, IRON_GOLEM, VILLAGER, HORSE, LEASH_HITCH, ENDER_CRYSTAL, SPLASH_POTION, EGG, FISHING_HOOK, LIGHTNING, WEATHER, PLAYER, COMPLEX_PART, FIREWORK, MINECART_CHEST, MINECART_FURNACE, MINECART_TNT, MINECART_HOPPER, MINECART_MOB_SPAWNER, MINECART_COMMAND, or UNKNOWN 3.3.1
Yes
entity_air() int entityID CastException

BadEntityException

Returns the amount of air the specified living entity has remaining. 3.3.1
Yes
entity_can_see() boolean entityID, otherEntityID CastException

BadEntityException

Returns if the entity can have the other entity in his line of sight. For instance for players this mean that it can have the other entity on its screen and that this one is not hidden by opaque blocks. This uses the same algorithm that hostile mobs use to find the closest player. 3.3.1
Yes
entity_exists() boolean entityID CastException

BadEntityException

Returns true if entity exists, otherwise false. 3.3.1
Yes
entity_grounded() boolean entityID CastException

BadEntityException

returns whether the entity is touching the ground 3.3.1
Yes
entity_id() string entityUUID CastException

BadEntityException

returns the entity id for unique persistent UUID 3.3.1
Yes
entity_line_of_sight() array entityID, [transparents, [maxDistance]] CastException

BadEntityException

Returns an array containg all blocks along the living entity's line of sight. transparents is an array of block IDs, only air by default. maxDistance represent the maximum distance to scan, it may be limited by the server by at least 100 blocks, no less. 3.3.1
Yes
entity_loc() locationArray entityID CastException

BadEntityException

Returns the location array for this entity, if it exists. This array will be compatible with any function that expects a location.
(Examples...)
3.3.1
Yes
entity_max_air() int entityID CastException

BadEntityException

Returns the maximum amount of air the specified living entity can have. 3.3.1
Yes
entity_onfire() int entityID CastException

BadEntityException

Returns the number of seconds until this entity stops being on fire, 0 if it already isn't. 3.3.1
Yes
entity_remove() void entityID CastException

BadEntityException

Removes the specified entity from the world, without any drops or animations. Note: you can't remove players. As a safety measure for working with NPC plugins, it will not work on anything human, even if it is not a player. 3.3.1
Yes
entity_spec() array entityID CastException

BadEntityException

Returns an associative array containing all the data of the given entity that are too specific to have its own function. See More... 3.3.1
Yes
entity_type() mixed entityID CastException Returns the EntityType of the entity with the specified ID. Returns null if the entity does not exist. 3.3.1
Yes
entity_uuid() string entityID CastException

BadEntityException

returns the persistent unique id of the entity 3.3.1
Yes
entity_velocity() array entityID CastException

BadEntityException

Returns an associative array indicating the x/y/z components of this entity's velocity. As a convenience, the magnitude is also included.
(Examples...)
3.3.1
Yes
get_art_at() string locationArray BadEntityException

FormatException

Gets the specified art at the given location. If the item at the specified location isn't a painting, an See More... 3.3.1
Yes
get_entity_age() int entityID CastException

BadEntityException

Returns the entity age as an integer, represented by server ticks. 3.3.1
Yes
get_entity_breedable() boolean entityID CastException

BadEntityException

Returns if an entity is set to be breedable. 3.3.1
Yes
get_entity_max_speed() double entityID BadEntityException

BadEntityTypeException
CastException

Returns a max speed for given entity. Make sure that the entity is a boat or minecart. 3.3.1
Yes
get_entity_persistence() boolean entityID CastException

BadEntityException

Returns whether the specified living entity will despawn. True means it will not. 3.3.1
Yes
get_entity_rider() mixed entityID CastException

BadEntityException

Returns the ID of the given entity's rider, or null if it doesn't have one. 3.3.1
Yes
get_entity_vehicle() mixed entityID CastException

BadEntityException

Returns the ID of the given entity's vehicle, or null if it doesn't have one. 3.3.1
Yes
get_equipment_droprates() array entityID CastException

BadEntityException

Returns an associative array of the drop rate for each equipment slot. If the rate is 0, the equipment will not drop. If it is 1, it is guaranteed to drop. 3.3.1
Yes
get_leashholder() int entityID CastException

BadEntityException

Returns the entityID of the entity that is holding the given living entity's leash, or null if it isn't being held. 3.3.1
Yes
get_max_health() double entityID CastException

BadEntityException

Returns the maximum health of this living entity. 3.3.1
Yes
get_mob_age() int entityID UnageableMobException

CastException
BadEntityException

Returns the mob's age as an integer. Zero represents the point of adulthood. Throws an UnageableMobException if the mob is not a type that ages 3.3.1
Yes
get_mob_effects() array entityID CastException

BadEntityException

Returns an array of potion arrays showing the effects on this mob.
(Examples...)
3.3.1
Yes
get_mob_equipment() equipmentArray entityID CastException

BadEntityException

Returns an associative array showing the equipment this entity is wearing.
(Examples...)
3.3.1
Yes
get_mob_name() string entityID CastException

BadEntityException

Returns the name of the given mob. 3.3.1
Yes
get_name_visible() boolean entityID CastException

BadEntityException

Returns whether or not a mob's custom name is always visible. If this is true it will be as visible as player names, otherwise it will only be visible when near the mob. 3.3.1
Yes
get_projectile_bounce() boolean entityID CastException

BadEntityException

Returns whether or not the given projectile should bounce or not when it hits something. 3.3.1
Yes
get_projectile_shooter() mixed entityID CastException

BadEntityException

Returns the shooter of the given projectile, can be null. If the shooter is an entity, that entity's ID will be return, but if it is a block, that block's location will be returned. 3.3.1
Yes
is_entity_living() boolean entityID CastException

BadEntityException

Returns true if entity is living, otherwise false. 3.3.1
Yes
play_entity_effect() void entityID, effect FormatException

CastException
BadEntityException

Plays the given visual effect on the entity. Non-applicable effects simply won't happen. Note: the death effect makes the mob invisible to players and immune to melee attacks. When used on players, they are shown the respawn menu, but because they are not actually dead, they can only log out. Possible effects are: DEATH, HURT, SHEEP_EAT, WOLF_HEARTS, WOLF_SHAKE, or WOLF_SMOKE 3.3.1
Yes
set_art_at() boolean locationArray, art FormatException Sets the art at the specified location. If the art doesn't fit, nothing happens, and false is returned. Otherwise, true is returned. See More... 3.3.1
Yes
set_can_pickup_items() void entityID, boolean FormatException

CastException
BadEntityException

Sets a living entity's ability to pick up items. 3.3.1
Yes
set_entity_age() void entityID, int CastException

BadEntityException
RangeException

Sets the age of the entity to the specified int, represented by server ticks. 3.3.1
Yes
set_entity_air() void entityID, int FormatException

CastException
BadEntityException

Sets the amount of air the specified living entity has remaining. 3.3.1
Yes
set_entity_breedable() void entityID, boolean FormatException

CastException
BadEntityException

Set an entity to be breedable. 3.3.1
Yes
set_entity_loc() boolean entityID, locationArray BadEntityException

FormatException
CastException
InvalidWorldException

Teleports the entity to the given location and returns whether the action was successful. Note this can set both location and direction.
(Examples...)
3.3.1
Yes
set_entity_max_air() void entityID, int FormatException

CastException
BadEntityException

Sets the maximum amount of air the specified living entity can have. 3.3.1
Yes
set_entity_max_speed() void entityID BadEntityException

BadEntityTypeException
CastException

Sets a max speed for given entity. Make sure that the entity is a boat or minecart. 3.3.1
Yes
set_entity_onfire() void entityID, seconds FormatException

CastException
BadEntityException

Sets the entity on fire for the given number of seconds. Throws a FormatException if seconds is less than 0. 3.3.1
Yes
set_entity_persistence() void entityID, boolean FormatException

CastException
BadEntityException

Sets whether a living entity will despawn. True means it will not. 3.3.1
Yes
set_entity_rider() boolean horse, rider FormatException

CastException
BadEntityException

Sets the way two entities are stacked. Horse and rider are entity ids. If rider is null, horse will eject its current rider, if it has one. If horse is null, rider will leave whatever it is riding. If horse and rider are both valid entities, rider will ride horse. The function returns the success of whatever operation is done. If horse and rider are both null, or otherwise the same, a FormatException is thrown. 3.3.1
Yes
set_entity_spec() void entityID, specArray CastException

BadEntityException
IndexOverflowException
IndexOverflowException
RangeException
FormatException

Sets the data in the specArray to the given entity. The specArray must follow the same format than in entity_spec(). All indexes in the specArray are optional. 3.3.1
Yes
set_entity_velocity() void entityID, array FormatException

CastException
BadEntityException

Sets the velocity of this entity according to the supplied xyz array. All 3 values default to 0, so an empty array will simply stop the entity's motion. Both normal and associative arrays are accepted.
(Examples...)
3.3.1
Yes
set_equipment_droprates() void entityID, array FormatException

CastException
BadEntityException

Sets the drop chances for each equipment slot on a mob, but does not work on players. Passing null instead of an array will automatically set all rates to 0, which will cause nothing to drop. A rate of 1 will guarantee a drop. 3.3.1
Yes
set_leashholder() void entityID, entityID FormatException

CastException
BadEntityException

The first entity is the entity to be held on a leash, and must be living. The second entity is the holder of the leash. This does not have to be living, but the only non-living entity that will persist as a holder across restarts is the leash hitch. Bats, enderdragons, players, and withers can not be held by leashes due to minecraft limitations. 3.3.1
Yes
set_max_health() void entityID, double FormatException

CastException
BadEntityException

Sets the max health of a living entity, players included. This value is persistent, and will not reset even after server restarts.
(Examples...)
3.3.1
Yes
set_mob_age() void entityID, int[, lockAge] UnageableMobException

CastException
BadEntityException

sets the age of the mob to the specified int, and locks it at that age if lockAge is true, but by default it will not. Throws a UnageableMobException if the mob does not age naturally. 3.3.1
Yes
set_mob_effect() boolean entityId, potionID, strength, [seconds], [ambient] CastException

FormatException
BadEntityException
RangeException

Effect is 1-23. Seconds defaults to 30. If the potionID is out of range, a RangeException is thrown, because out of range potion effects cause the client to crash, fairly hardcore. See http://www.minecraftwiki.net/wiki/Potion_effects for a complete list of potions that can be added. To remove an effect, set the seconds to 0. Strength is the number of levels to add to the base power (effect level 1). Ambient takes a boolean of whether the particles should be less noticeable. The function returns true if the effect was added or removed as desired, and false if it wasn't (however, this currently only will happen if an effect is attempted to be removed, yet isn't already on the mob). 3.3.1
Yes
set_mob_equipment() void entityID, array FormatException

CastException
BadEntityException

Takes an associative array with keys representing equipment slots and values of itemArrays, the same used by set_pinv. The equipment slots are: WEAPON, BOOTS, LEGGINGS, CHESTPLATE, or HELMET
(Examples...)
3.3.1
Yes
set_mob_name() void entityID, name FormatException

CastException
BadEntityException

Sets the name of the given mob. This automatically truncates if it is more than 64 characters. 3.3.1
Yes
set_name_visible() void entityID, boolean FormatException

CastException
BadEntityException

Sets the visibility of a mob's custom name. True means it will be visible from a distance, like a playername. False means it will only be visible when near the mob. 3.3.1
Yes
set_projectile_bounce() void entityID, boolean FormatException

CastException
BadEntityException

Sets whether or not the given projectile should bounce or not when it hits something. 3.3.1
Yes
set_projectile_shooter() void entityID, shooterID FormatException

CastException
BadEntityException

Sets the shooter of the given projectile, can be null. 3.3.1
Yes
shoot_projectile() int [entity[, projectile]]
player, projectile, target[, speed]
BadEntityException

BadEntityTypeException
FormatException
PlayerOfflineException

shoots an entity from the specified location (can be entityID, player name or location array), or the current player if no arguments are passed. If no entity type is specified, it defaults to a fireball. If provide three arguments, with target (entityID, player name or location array), entity will shoot to target location. Last, fourth argument, is double and specifies the speed of projectile. Returns the EntityID of the entity. Valid entities types: DROPPED_ITEM, EXPERIENCE_ORB, PAINTING, ARROW, SNOWBALL, FIREBALL, SMALL_FIREBALL, ITEM_FRAME, WITHER_SKULL, WITHER, BAT, WITCH, ENDER_PEARL, ENDER_SIGNAL, THROWN_EXP_BOTTLE, PRIMED_TNT, FALLING_BLOCK, MINECART, BOAT, CREEPER, SKELETON, SPIDER, GIANT, ZOMBIE, SLIME, GHAST, PIG_ZOMBIE, ENDERMAN, CAVE_SPIDER, SILVERFISH, BLAZE, MAGMA_CUBE, ENDER_DRAGON, PIG, SHEEP, COW, CHICKEN, SQUID, WOLF, MUSHROOM_COW, SNOWMAN, OCELOT, IRON_GOLEM, VILLAGER, HORSE, LEASH_HITCH, ENDER_CRYSTAL, SPLASH_POTION, EGG, FISHING_HOOK, LIGHTNING, WEATHER, PLAYER, COMPLEX_PART, FIREWORK, MINECART_CHEST, MINECART_FURNACE, MINECART_TNT, MINECART_HOPPER, MINECART_MOB_SPAWNER, MINECART_COMMAND, or UNKNOWN 3.3.1
Yes
spawn_entity() array entityType, [qty], [location] CastException

FormatException
BadEntityException
InvalidWorldException
PlayerOfflineException

Spawns the specified number of entities of the given type at the given location. Returns an array of entityIDs of what is spawned. Qty defaults to 1 and location defaults to the location of the commandsender, if it is a block or player. If the commandsender is console, location must be supplied. See More... 3.3.1
Yes

Environment

Allows you to manipulate the environment around the player

Function Name Returns Arguments Throws Description Since Restricted
break_block() void locationArray FormatException Mostly simulates a block break at a location. Does not trigger an event. Only works with craftbukkit. 3.3.0
Yes
explosion() void Locationarray, [size], [safe] FormatException

CastException
LengthException
InvalidWorldException

Creates an explosion with the given size at the given location.Size defaults to size of a creeper (3), and null uses the default. If safe is true, (defaults to false) the explosion won't hurt the surrounding blocks. If size is 0, and safe is true, you will still see the animation and hear the sound, but players won't be hurt, and neither will the blocks. 3.3.1
Yes
generate_tree() boolean locationArray, [treeType] CastException

BadEntityException
FormatException

Generates a tree at the given location and returns if the generation succeeded or not. treeType can be TREE, BIG_TREE, REDWOOD, TALL_REDWOOD, BIRCH, JUNGLE, SMALL_JUNGLE, JUNGLE_BUSH, RED_MUSHROOM, BROWN_MUSHROOM, SWAMP, ACACIA, or DARK_OAK, defaulting to TREE. 3.3.1
Yes
get_biome() string x, z, [world]
locationArray
FormatException

CastException
InvalidWorldException

Returns the biome type of this block column. The location array's y value is ignored. See More... 3.3.1
Yes
get_block_at() string x, y, z, [world]
xyzArray, [world]
FormatException

CastException
LengthException
InvalidWorldException

Gets the id of the block at x, y, z. This function expects either 1 or 3 arguments. If 1 argument is passed, it should be an array with the x, y, z coordinates. The format of the return will be x:y where x is the id of the block, and y is the meta data for the block. All blocks will return in this format, but blocks that don't have meta data normally will return 0 in y. If world isn't specified, the current player's world is used. 3.0.2
Yes
get_block_command() string locationArray CastException

FormatException

Returns the command string in the Command Block at the given location. 3.3.1
Yes
get_block_info() array locationArray CastException

FormatException

Returns an associative array with various information about a block See More... 3.3.1
Yes
get_command_block_name() string locationArray CastException

FormatException

Returns the name of the Command Block at the given location. 3.3.1
Yes
get_highest_block_at() array x, z, [world]
xyzArray, [world]
FormatException

CastException
LengthException
InvalidWorldException

Gets the xyz of the highest block at a x and a z.It works the same as get_block_at, except that it doesn't matter now what the Y is.You can set it to -1000 or to 92374 it will just be ignored. 3.3.1
Yes
get_light_at() int locationArray CastException

InvalidWorldException
FormatException

Returns the combined light level at a block, taking into account all sources. 3.3.1
No
get_sign_text() array xyzLocation RangeException

FormatException

Given a location array, returns an array of 4 strings of the text in the sign at that location. If the location given isn't a sign, then a RangeException is thrown. 3.3.0
Yes
is_block_powered() boolean locationArray CastException

InvalidWorldException
FormatException

Returns whether or not a block is being supplied with power. Be aware that this interprets 'powered' differently than a human would. For example, using this on a piston next to a redstone block will return false. 3.3.1
No
is_sign_at() boolean xyzLocation FormatException Returns true if the block at this location is a sign. 3.3.0
Yes
play_named_sound() void locationArray, soundArray[, players] InvalidWorldException

CastException
FormatException
PlayerOfflineException

Plays a sound at the given location. SoundArray is in an associative array with keys 'sound', 'volume', 'pitch', where volume and pitch are optional and default to 1. Players can be a single player or an array of players to play the sound to, if not given, all players can potentially hear it. Sound is a sound path, separated by periods. 3.3.1
Yes
play_note() void [player], instrument, note, [location] CastException

RangeException
FormatException
PlayerOfflineException

Plays a note for the given player, at the given location. Player defaults to the current player, and location defaults to the player's location. Instrument may be one of: PIANO, BASS_DRUM, SNARE_DRUM, STICKS, or BASS_GUITAR, and note is an associative array with 2 values, array(octave: 0, tone: 'F#') where octave is either 0, 1, or 2, and tone is one of the notes G, A, B, C, D, E, or F, optionally suffixed with a pound symbol, which denotes a sharp. (Not all notes can be sharped.) 3.3.1
Yes
play_sound() void locationArray, soundArray[, players] InvalidWorldException

CastException
FormatException
PlayerOfflineException

Plays a sound at the given location. SoundArray is in an associative array with keys 'sound', 'volume', 'pitch', where volume and pitch are optional and default to 1. Players can be a single player or an array of players to play the sound to, if not given, all players can potentially hear it. See More... 3.3.1
Yes
set_biome() void x, z, [world], biome
locationArray, biome
FormatException

CastException

Sets the biome of the specified block column. The location array's y value is ignored. See More... 3.3.1
Yes
set_block_at() void x, y, z, id, [world] [physics]
locationArray, id, [physics]
CastException

LengthException
FormatException
InvalidWorldException

Sets the id of the block at the x y z coordinates specified. If the first argument passed is an array, it should be x, y, z, world coordinates. Id must be a blocktype identifier similar to the type returned from get_block_at, except if the meta value is not specified, 0 is used. If world isn't specified, the current player's world is used. Physics (which defaults to true) specifies whether or not to update the surrounding blocks when this block is set. 3.0.2
Yes
set_block_command() void locationArray, [cmd] CastException

FormatException

Sets a command to a Command Block at the given location.If no command is given or parameter is null, it clears the Command Block. 3.3.1
Yes
set_command_block_name() void locationArray, [name] CastException

FormatException

Sets the name of the Command Block at the given location.If no name is given or name is null, the Command Block's name is reset to @. 3.3.1
Yes
set_sign_text() void xyzLocation, lineArray
xyzLocation, line1, [line2, [line3, [line4]]]
RangeException

FormatException

Sets the text of the sign at the given location. If the block at x,y,z isn't a sign, a RangeException is thrown. If the text on a line overflows 15 characters, it is simply truncated. 3.3.0
Yes

EventBinding

This class of functions provide methods to hook deep into the server's event architecture

Function Name Returns Arguments Throws Description Since Restricted
bind() string event_name, options, prefilter, event_obj, [custom_params], <code> BindException Binds some functionality to an event, so that when said event occurs, the event handler will fire. Returns the id of this event, so it can be unregistered later, if need be. 3.3.0
Yes
cancel() void [state] BindException Cancels the event (if applicable). If the event is not cancellable, or is already set to the specified cancelled state, nothing happens. If called from outside an event handler, a BindException is thrown. By default, state is true, but you can uncancel an event (if possible) by calling cancel(false). 3.3.0
Yes
consume() void BindException Consumes an event, so that lower priority handlers don't even recieve the event. Monitor level handlers will still recieve it, however, and they can check to see if the event was consumed. 3.3.0
Yes
dump_events() array Returns an array of all the events currently registered on the server. Mostly meant for debugging, however it would be possible to parse this response to cherry pick events to unregister. 3.3.0
Yes
event_meta() array BindException Returns meta information about the activity in regards to this event. This is meant as a debug tool. 3.3.0
Yes
has_bind() boolean id Returns true if a bind with the specified id exists and is currently bound. False is returned otherwise. This can be used to pre-emptively avoid a BindException if duplicate ids are used. 3.3.1
Yes
is_cancelled() boolean BindException Returns whether or not the underlying event is cancelled or not. If the event is not cancellable in the first place, false is returned. If called from outside an event, a BindException is thrown 3.3.0
Yes
is_consumed() boolean BindException Returns whether or not this event has been consumed. Usually only useful for Monitor level handlers, it could also be used for highly robust code, as an equal priority handler could have consumed the event, but this handler would still recieve it. 3.3.0
Yes
is_locked() boolean parameter BindException Returns whether or not a call to modify_event() would fail, based on the parameter being locked by a higher priority handler. If this returns false, it is still not a guarantee that the event would be successfully modified, just that it isn't locked. 3.3.0
Yes
lock() void <none>
parameterArray
parameter, [parameter...]
BindException Locks the specified event parameter(s), or all of them, if specified with no arguments. Locked parameters become read only for lower priority event handlers. 3.3.0
Yes
modify_event() boolean parameter, value, [throwOnFailure] CastException

BindException

Modifies the underlying event object, if applicable. The documentation for each event will explain what parameters can be modified, and what their expected values are. See More... 3.3.0
Yes
trigger() void eventName, eventObject, [serverWide] CastException Manually triggers bound events. The event object passed to this function is sent directly as-is to the bound events. Check the documentation for each event to see what is required. No checks will be done on the data here, but it is not recommended to fail to send all parameters required. If serverWide is true, the event is triggered directly in the server, unless it is a CommandHelper specific event, in which case, serverWide is irrelevant. Defaults to false, which means that only CommandHelper code will receive the event. 3.3.0
Yes
unbind() void [eventID] BindException Unbinds an event, which causes it to not run anymore. If called from within an event handler, eventID is optional, and defaults to the current event id. 3.3.0
Yes

Exceptions

This class contains functions related to Exception handling in MethodScript

Function Name Returns Arguments Throws Description Since Restricted
set_uncaught_exception_handler() closure closure(@ex) CastException Sets the uncaught exception handler, returning the currently set one, or null if none has been set yet. If code throws an exception, instead of doing the default (displaying the error to the user/console) it will run your code instead. The exception that was thrown will be passed to the closure, and it is expected that the closure returns either null, true, or false. See More...
(Examples...)
3.3.1
Yes
throw() nothing exceptionType, msg FormatException This function causes an exception to be thrown. If the exception type is null, it will be uncatchable. Otherwise, exceptionType may be any valid exception type.

Valid Exceptions: CastException, IndexOverflowException, RangeException, LengthException, InsufficientPermissionException, PlayerOfflineException, InsufficientArgumentsException, FormatException, InvalidProcedureException, IncludeException, SecurityException, IOException, InvalidPluginException, PluginInternalException, InvalidWorldException, BindException, EnchantmentException, UnageableMobException, UntameableMobException, NullPointerException, BadEntityException, BadEntityTypeException, ReadOnlyException, ScoreboardException, PluginChannelException, NotFoundException, StackOverflowError, ShellException, SQLException

3.1.2
No
try() void tryCode, [varName, catchCode, [exceptionTypes]]
tryCode, catchCode
CastException

FormatException

This function works similar to a try-catch block in most languages. If the code in tryCode throws an exception, instead of killing the whole script, it stops running, and begins running the catchCode. var should be an ivariable, and it is set to an array containing the following information about the exception: 0 - The class of the exception; 1 - The message generated by the exception; 2 - The file the exception was generated from; 3 - The line the exception occured on. See More... 3.1.2
No

ExecutionQueue

An execution queue is a queue of closures, which are queued up to be run in sequence by the engine. Unlike set_timeout and set_interval, there is no time component, it's simply a queue of operations to execute sequentially. See the article on the learning trail for more information.

Function Name Returns Arguments Throws Description Since Restricted
queue_clear() void [queue] Clears out all tasks that are on the queue. If no tasks were on the queue, nothing happens. 3.3.1
Yes
queue_delay() void x, [queue] CastException Queues up a non-disruptive sleep at the end of the queue. This task will stall the execution thread for x milliseconds. 3.3.1
Yes
queue_delay_front() void x, [queue] CastException Works like queue_delay, but puts the delay at the front of the queue. 3.3.1
Yes
queue_push() void closure, [queue] CastException Queues a task up at the end of the specified queue. 3.3.1
Yes
queue_push_front() void closure, [queue] CastException Queues a task at the front of the queue. 3.3.1
Yes
queue_remove() void [queue] Removes the last task at the end of the queue from the queue. 3.3.1
Yes
queue_remove_front() void [queue] Removes a task from the front of the queue. That is, the next task that would have been run is removed. 3.3.1
Yes
queue_running() boolean [queue] Returns true if the specified queue still has tasks running on it. 3.3.1
Yes

ExtensionMeta

Provides the ability for finding out information about installed extensions, including events and functions.

Function Name Returns Arguments Throws Description Since Restricted
event_exists() boolean name Returns true if the event is known to CommandHelper. 3.3.1
No
extension_info() boolean name Returns extension info for the extensions the system has loaded. Included data will be events, functions and version, keyed by the name of the extension (or __unidentified__ if it's an old-style extension). 3.3.1
No
function_exists() boolean name Returns true if the function is known to CommandHelper. This is a special function; it is resolved at compile time, and allows for conditional uses of functions that may or may not exist, such as functions that might or might not be loaded in an extension, or from different versions. This is useful for shared code in environments where an extension may or may not be available, or an older version of CommandHelper. if(function_exists('my_extension_function')){ my_extension_function() } can then be used to selectively "bypass" the compiler restrictions that would normally cause a fatal compile error, since that function is missing. Therefore, you can wrap extension related code around extension specific blocks, and make that code portable to other installations that may not have the extension installed.
(Examples...)
3.3.1
No

FileHandling

This class contains methods that help manage files on the file system. Most are restricted with the base-dir setting in your preferences.

Function Name Returns Arguments Throws Description Since Restricted
async_read() void file, callback SecurityException Asyncronously reads in a file. See More... 3.3.1
Yes
file_size() int path IOException

SecurityException

Returns the size of a file on the file system. 3.3.1
Yes
read() string file IOException

SecurityException

Reads in a file from the file system at location var1 and returns it as a string. The path is relative to the file that is being run, not CommandHelper. If the file is not found, or otherwise can't be read in, an IOException is thrown. If the file specified is not within base-dir (as specified in the preferences file), a SecurityException is thrown. The line endings for the string returned will always be \n, even if they originally were \r\n. 3.0.1
Yes
read_binary() byte_array file IOException Reads in a file, and returns a byte_array for it. The file is returned exactly as is on disk, no conversions are done. base-dir restrictions are enforced for the path, the same as read(). If file is relative, it is assumed to be relative to this file. This is useful for managing binary files. 3.3.1
Yes
read_gzip_binary() byte_array file IOException Reads in a gzipped file, and returns a byte_array for it. The file is returned exactly as is on disk, no conversions are done. base-dir restrictions are enforced for the path, the same as read(). If file is relative, it is assumed to be relative to this file. 3.3.1
Yes

InventoryManagement

Provides methods for managing inventory related tasks.

Function Name Returns Arguments Throws Description Since Restricted
add_to_inventory() int entityID, itemID, qty, [meta]
locationArray, itemID, qty, [meta]
CastException

FormatException

Add to block or entity inventory the specified item * qty. The meta argument uses the same format as set_itemmeta. Unlike set_inventory(), this does not specify a slot. The qty is distributed in the inventory, first filling up slots that have the same item type, up to the max stack size, then fills up empty slots, until either the entire inventory is filled, or the entire amount has been given. If the inventory is full, number of items that were not added is returned, which will be less than or equal to the quantity provided. Otherwise, returns 0. Supports 'infinite' stacks by providing a negative number. 3.3.1
Yes
close_pinv() void [player] PlayerOfflineException Closes the inventory of the current player, or of the specified player. 3.3.1
Yes
get_inventory() mixed entityID, [index]
locationArray, [index]
CastException

RangeException
FormatException

Gets the inventory information for the specified block or entity. If the block or entity can't have an inventory, a FormatException is thrown. If the index is specified, only the slot given will be returned. The max index of the array in the array is different for different types of inventories. If there is no item at the slot specified, null is returned. See More... 3.3.1
Yes
get_inventory_item() array entityID, slotNumber
locationArray, slotNumber
FormatException

CastException

If a number is provided, it is assumed to be an entity, and if the entity supports inventories, it will be valid. Otherwise, if a location array is provided, it is assumed to be a block (chest, brewer, etc) and interpreted thusly. Depending on the inventory type, the max index will vary. If the index is too large, a RangeException is thrown, otherwise, the item at that location is returned as an item array, or null, if no item is there. You can determine the inventory type (and thus the max index count) with get_inventory_type(). An itemArray, like the one used by pinv/set_pinv is returned. 3.3.1
Yes
get_inventory_size() int entityID
locationArray
FormatException

CastException

Returns the max size of the inventory specified. If the block or entity can't have an inventory, a FormatException is thrown. 3.3.1
Yes
get_inventory_type() string entityID
locationArray
CastException

FormatException

Returns the inventory type at the location specified, or of the entity specified. If the entity or location specified is not capable of having an inventory, a FormatException is thrown. See More... 3.3.1
Yes
penchanting() void [player] PlayerOfflineException Shows an enchanting to the current player, or a specified player. Note that power is defined by how many bookcases are near. 3.3.1
Yes
penderchest() mixed [player, [index]] PlayerOfflineException

CastException
RangeException

Gets the inventory information for the specified player's enderchest, or the current player if none specified. If the index is specified, only the slot given will be returned. The index of the array in the array is 0 - 26, which corresponds to the slot in the enderchest inventory. If there is no item at the slot specified, null is returned. See More... 3.3.1
Yes
pgive_enderchest_item() int [player], itemID, qty, [meta] CastException

FormatException
PlayerOfflineException

Add to a player ender chest the specified item * qty. The meta argument uses the same format as set_itemmeta. Unlike set_penderchest(), this does not specify a slot. The qty is distributed in the player's inventory, first filling up slots that have the same item type, up to the max stack size, then fills up empty slots, until either the entire inventory is filled, or the entire amount has been given. If the player's inv is full, number of items that were not added is returned, which will be less than or equal to the quantity provided. Otherwise, returns 0. Supports 'infinite' stacks by providing a negative number. 3.3.1
Yes
pgive_item() int [player], itemID, qty, [meta] CastException

FormatException
PlayerOfflineException

Gives a player the specified item * qty. The meta argument uses the same format as set_itemmeta. Unlike set_pinv(), this does not specify a slot. The qty is distributed in the player's inventory, first filling up slots that have the same item type, up to the max stack size, then fills up empty slots, until either the entire inventory is filled, or the entire amount has been given. If the player's inv is full, number of items that were not added is returned, which will be less than or equal to the quantity provided. Otherwise, returns 0. This function will not touch the player's armor slots however. Supports 'infinite' stacks by providing a negative number. 3.3.0
Yes
phas_item() int [player], itemId PlayerOfflineException

FormatException
CastException

Returns the quantity of the specified item that the player is carrying (including armor slots). This counts across all slots in inventory. Recall that 0 is false, and anything else is true, so this can be used to get the total, or just see if they have the item. itemId can be either a plain number, or a 0:0 number, indicating a data value. 3.3.0
Yes
pinv() mixed [player, [index]] PlayerOfflineException

CastException
RangeException

Gets the inventory information for the specified player, or the current player if none specified. If the index is specified, only the slot given will be returned. The index of the array in the array is 0 - 35, 100 - 103, which corresponds to the slot in the players inventory. To access armor slots, you may also specify the index. (100 - 103). The quick bar is 0 - 8. If index is null, the item in the player's hand is returned, regardless of what slot is selected. If there is no item at the slot specified, null is returned. See More... 3.1.3
Yes
pinv_open() void [playerToShow,] playerInventory PlayerOfflineException Opens a player's inventory, shown to the player specified's screen. 3.3.1
Yes
pitem_slot() array [player], itemID CastException

FormatException
PlayerOfflineException

Given an item id, returns the slot numbers that the matching item has at least one item in. 3.3.0
Yes
ptake_enderchest_item() int [player], itemID, qty CastException

PlayerOfflineException
FormatException

Works in reverse of pgive_enderchest_item(), but returns the number of items actually taken, which will be from 0 to qty. 3.3.1
Yes
ptake_item() int [player], itemID, qty CastException

PlayerOfflineException
FormatException

Works in reverse of pgive_item(), but returns the number of items actually taken, which will be from 0 to qty. 3.3.0
Yes
pworkbench() void [player] PlayerOfflineException Shows a workbench to the current player, or a specified player. 3.3.1
Yes
set_inventory() void entityID, pinvArray
locationArray, pinvArray
CastException

FormatException

Sets a block or entity inventory to the specified inventory object. If the block or entity can't have an inventory, a FormatException is thrown. An inventory object pinvArray is one that matches what is returned by get_inventory(), so set_inventory(123, get_inventory(123)) while pointless, would be a correct call. See More... 3.3.1
Yes
set_inventory_item() void entityID, index, itemArray
locationArray, index, itemArray
FormatException

CastException

Sets the specified item in the specified slot given either an entityID or a location array of a container object. See get_inventory_type for more information. The itemArray is an array in the same format as pinv/set_pinv takes. 3.3.1
Yes
set_penderchest() void [player], pinvArray PlayerOfflineException

CastException
FormatException

Sets a player's enderchest's inventory to the specified inventory object. An inventory object is one that matches what is returned by penderchest(), so set_penderchest(penderchest()), while pointless, would be a correct call. See More... 3.3.1
Yes
set_pinv() void [player], pinvArray PlayerOfflineException

CastException
FormatException

Sets a player's inventory to the specified inventory object. An inventory object is one that matches what is returned by pinv(), so set_pinv(pinv()), while pointless, would be a correct call. See More... 3.2.0
Yes
show_enderchest() void [player [, player]] PlayerOfflineException Shows the enderchest of either the current player or the specified player if given. If a second player is specified, shows the second player the contents of the first player's enderchest. 3.3.1
Yes
take_from_inventory() int entityID, itemID, qty
locationArray, itemID, qty
CastException

FormatException

Works in reverse of add_to_inventory(), but returns the number of items actually taken, which will be from 0 to qty. 3.3.1
Yes

ItemMeta

These functions manipulate an item's meta data. The items are modified in a player's inventory.

Function Name Returns Arguments Throws Description Since Restricted
get_armor_color() colorArray [player], inventorySlot CastException

PlayerOfflineException

Returns a color array for the color of the leather armor at the given slot. A CastException is thrown if this is not leather armor at that slot. The color array returned will look like: array(r: 0, g: 0, b: 0) 3.3.1
Yes
get_itemmeta() mixed [player,] inventorySlot PlayerOfflineException

CastException

Returns an associative array of known ItemMeta for the slot given, or null if there isn't any. All items can have a display(name), lore, and/or enchants, and more info will be available for the items that have it. See More...
(Examples...)
3.3.1
Yes
is_leather_armor() boolean [player], itemSlot CastException

PlayerOfflineException

Returns true if the item at the given slot is a piece of leather armor, that is, if dying it is allowed. 3.3.1
Yes
set_armor_color() void [player], slot, colorArray CastException

PlayerOfflineException
FormatException

Sets the color of the leather armor at the given slot. colorArray should be an array that matches one of the formats: array(r: 0, g: 0, b: 0) array(red: 0, green: 0, blue: 0) array(0, 0, 0) 3.3.1
Yes
set_itemmeta() void [player,] inventorySlot, ItemMetaArray PlayerOfflineException

FormatException
CastException

Applies the data from the given array to the item at the specified slot. Unused fields will be ignored. If null or an empty array is supplied, or if none of the given fields are applicable, the item will become default, as this function overwrites any existing data. See More...
(Examples...)
3.3.1
Yes

Marquee

This class provides methods for making a text "marquee", like a stock ticker. Because this is a threading operation, and could be potentially resource intensive, the heavy lifting has been implemented natively.

Function Name Returns Arguments Throws Description Since Restricted
marquee() void [marqueeName], text, stringWidth, delayTime, callback CastException Sets up a marquee, which will automatically split up a given string for you, and call the callback. The split string will automatically wrap, handle buffering spaces, and scroll through the text. See More... 3.3.1
Yes
marquee_stop() void marqueeName Stops a named marquee. 3.3.1
Yes

Math

Provides mathematical functions to scripts

Function Name Returns Arguments Throws Description Since Restricted
abs() mixed arg CastException Returns the absolute value of the argument.
(Examples...)
3.1.2
No
acos() double number CastException Returns the arc cos of the number 3.3.0
No
add() mixed var1, [var2...] CastException Adds all the arguments together, and returns either a double or an integer. Operator syntax is also supported: @a + @b
(Examples...)
3.0.1
No
asin() double number CastException Returns the arc sin of the number 3.3.0
No
atan() double number CastException Returns the arc tan of the number 3.3.0
No
atan2() double y, x CastException Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta). This method computes the phase theta by computing an arc tangent of y/x in the range of -pi to pi. 3.3.0
No
ceil() int number CastException Returns the ceiling of any given number. For example, ceil(3.2) returns 4, and ceil(-1.1) returns -1 3.1.3
No
cos() double number CastException Returns the cos of the number 3.3.0
No
dec() ivar var, [value] CastException Subtracts value from var, and stores the new value. Value defaults to 1. Equivalent to --var (or var -= value) in other languages. Expects ivar to be a variable, then returns the ivar, or if var is a constant number, simply adds x to it, and returns the new number. Operator syntax is also supported: --@var
(Examples...)
3.0.1
No
divide() mixed var1, [var2...] CastException

RangeException

Divides the arguments from left to right, and returns either a double or an integer. If you divide by zero, a RangeException is thrown. Operator syntax is also supported: 2 / 2
(Examples...)
3.0.1
No
expr() double expression, [valueArray] CastException

PluginInternalException

Sometimes, when you need to calculate an advanced mathematical expression, it is messy to write out everything in terms of functions. This function will allow you to evaluate a mathematical expression as a string, using common mathematical notation. For example, (2 + 3) * 4 would return 20. Variables can also be included, and their values given as an associative array. expr('(x + y) * z', array(x: 2, y: 3, z: 4)) would be the same thing as the above example. 3.3.0
No
floor() int number CastException Returns the floor of any given number. For example, floor(3.8) returns 3, and floor(-1.1) returns 2 3.1.3
No
inc() ivar var, [x] CastException Adds x to var, and stores the new value. Equivalent to ++var in other languages. Expects ivar to be a variable, then returns the ivar, or, if var is a constant number, simply adds x to it, and returns the new number. Operator syntax is also supported: ++@var
(Examples...)
3.0.1
No
logarithm() double val, [base] CastException

RangeException

Return the log of a number to the specified base, or the mathematical constant e if no base is provided (or ln). If val is less than or equal to zero, a RangeException is thrown. Mathematically speaking, if val is 0, then the result would be negative infinity, and if it is less than 0 it is undefined (NaN), but since MethodScript has no way of representing either of these, a RangeException is thrown instead.
(Examples...)
3.3.1
No
max() number num1, [num2...] CastException

InsufficientArgumentsException

Returns the highest number in a given list of numbers. If any of the arguments are arrays, they are expanded into individual numbers, and also compared. 3.2.0
No
min() number num1, [num2...] CastException

InsufficientArgumentsException

Returns the lowest number in a given list of numbers. If any of the arguments are arrays, they are expanded into individual numbers, and also compared. 3.2.0
No
mod() int x, n CastException Returns x modulo n. Operator syntax is also supported: @x % @n
(Examples...)
3.0.1
No
multiply() mixed var1, [var2...] CastException Multiplies the arguments together, and returns either a double or an integer. Operator syntax is also supported: 2 * 2
(Examples...)
3.0.1
No
neg() number number CastException Negates a number, essentially multiplying the number by -1 3.3.1
No
postdec() ivar var, [x] CastException Subtracts x from var, and stores the new value. Equivalent to var-- in other languages. Expects ivar to be a variable, then returns a copy of the old ivar, , or, if var is a constant number, simply adds x to it, and returns the new number. Operator syntax is also supported: @var--
(Examples...)
3.3.1
No
postinc() ivar var, [x] CastException Adds x to var, and stores the new value. Equivalent to var++ in other languages. Expects ivar to be a variable, then returns a copy of the old ivar, or, if var is a constant number, simply adds x to it, and returns the new number. Operator notation is also supported: @var++
(Examples...)
3.3.1
No
pow() double x, n CastException Returns x to the power of n. Operator syntax is also supported: @x ** @n
(Examples...)
3.0.1
No
rand() mixed []
min/max, [max]
RangeException

CastException

Returns a random number from 0 to max, or min to max, depending on usage. Max is exclusive. Min must be less than max, and both numbers must be >= 0. This will return an integer. Alternatively, you can pass no arguments, and a random double, from 0 to 1 will be returned.
(Examples...)
3.0.1
No
round() mixed number, [precision] CastException

RangeException

Unlike floor and ceil, rounds the number to the nearest integer. Precision defaults to 0, but if set to 1 or more, rounds decimal places. For instance, round(2.29, 1) would return 2.3. If precision is < 0, a RangeException is thrown. If precision is set to 0, an integer is always returned, and if precision is > 0, a double is always returned.
(Examples...)
3.3.0
No
sin() double number CastException Returns the sin of the number 3.3.0
No
sqrt() number number RangeException

CastException

Returns the square root of a number. Note that this is mathematically equivalent to pow(number, .5). Imaginary numbers are not supported, so number must be positive. 3.2.0
No
subtract() mixed var1, [var2...] CastException Subtracts the arguments from left to right, and returns either a double or an integer. Operator syntax is also supported: @a - @b
(Examples...)
3.0.1
No
tan() double number CastException Returns the tan of the number 3.3.0
No
to_degrees() double number CastException Converts the number to degrees (which is assumed to have been in radians) 3.3.0
No
to_radians() double number CastException Converts the number to radians (which is assumed to have been in degrees) 3.3.0
No

Meta

These functions provide a way to run other commands

Function Name Returns Arguments Throws Description Since Restricted
call_alias() boolean cmd Allows a CommandHelper alias to be called from within another alias. Typically this is not possible, as a script that runs "/jail = /jail" for instance, would simply be calling whatever plugin that actually provides the jail functionality's /jail command. However, using this function makes the command loop back to CommandHelper only. See More... 3.2.0
No
capture_runas() string player, command PlayerOfflineException

FormatException
PluginInternalException

Works like runas, except any messages sent to the command sender during command execution are attempted to be intercepted, and are then returned as a string, instead of being sent to the command sender. Note that this is VERY easy for plugins to get around in such a way that this function will not work, this is NOT a bug in CommandHelper, nor is it necessarily a problem in the other plugin either, but the other plugin will have to make changes for it to work properly. A PluginInternalException is thrown if something goes wrong. Any number of things may go wrong that aren't necessarily this function's fault, and in those cases, this exception is thrown.
(Examples...)
3.3.1
Yes
eval() string script_string CastException Executes arbitrary MethodScript. Note that this function is very experimental, and is subject to changing or removal. 3.1.0
Yes
get_cmd() mixed Gets the command (as a string) that ended up triggering this script, exactly how it was entered by the player. This could be null, if for instance it is called from within an event. 3.3.0
No
get_command_block() locationArray If this command was being run from a command block, this will return the location of the block. If a player or console ran this command, (or any other command sender) this will return null. 3.3.1
No
is_alias() boolean cmd IOException Returns true if using call_alias with this cmd would trigger an alias. 3.3.1
Yes
psetop() string [player], status PlayerOfflineException Sets whether or not a player has operator status. If no player is specified the player running the script is given. 3.3.1
Yes
run() void var1 FormatException

PluginInternalException

Runs a command as the current player. Useful for running commands in a loop. Note that this accepts commands like from the chat; with a forward slash in front. 3.0.1
No
run_cmd() void cmd FormatException Runs a command regardless of whether or not it is an alias or a builtin command. Essentially, this works like checking if(is_alias(@cmd)){ call_alias(@cmd) } else { run(@cmd) }. Be careful with this command, as like call_alias(), you could accidentally create infinite loops. The command must start with a / or this will throw a FormatException. 3.3.1
No
runas() void player, command FormatException

PlayerOfflineException

Runs a command as a particular user. The special user '~console' can be used to run it as a console user. Using '~op' is deprecated, and will be removed after the next release, use sudo() instead. Commands cannot be run as an offline player. If the first argument is an array of usernames, the command will be run in the context of each user in the array. 3.0.1
Yes
scriptas() void player, [label], script PlayerOfflineException Runs the specified script in the context of a given player. A script that runs player() for instance, would return the specified player's name, not the player running the command. Setting the label allows you to dynamically set the label this script is run under as well (in regards to permission checking) 3.3.0
Yes
sudo() void command FormatException Runs a single command for this user, as op. Works like runas(~op, '/command') used to work, before it was deprecated. See More... 3.3.1
Yes

Minecraft

These functions provide a hook into game functionality.

Function Name Returns Arguments Throws Description Since Restricted
data_name() string int
itemArray
CastException

FormatException

Performs the reverse functionality as data_values. Given 1, returns 'Stone'. Note that the enum value given in bukkit's Material class is what is returned as a fallback, if the id doesn't match a value in the internally maintained list. If a completely invalid argument is passed in, null is returned. 3.3.0
No
data_values() int var1 Does a lookup to return the data value of a name. For instance, returns 1 for 'stone'. If an integer is given, simply returns that number. If the data value cannot be found, null is returned. 3.0.1
No
drop_item() int [player/LocationArray], item, [spawnNaturally] CastException

FormatException
PlayerOfflineException
InvalidWorldException

Drops the specified item stack at the specified player's feet (or at an arbitrary Location, if an array is given), and returns its entity id Like the vanilla /give command. player defaults to the current player, and qty defaults to 1. item takes an item array. spawnNaturally takes a boolean, which forces the way the item will be spawned. If true, the item will be dropped with a random offset. 3.2.0
Yes
get_banned_players() Array An array of players banned on the server. 3.3.1
No
get_entity_health() double entityID CastException

BadEntityException

Returns the entity's health as a percentage of its maximum health. If the specified entity doesn't exist, or is not a LivingEntity, a format exception is thrown. 3.3.0
Yes
get_ip_bans() array Returns an array of entries from banned-ips.txt. 3.3.1
Yes
get_mob_owner() string entityID UntameableMobException

CastException
BadEntityException

Returns the owner's name, or null if the mob is unowned. An UntameableMobException is thrown if mob isn't tameable to begin with. 3.3.0
Yes
get_server_info() mixed [value] CastException

RangeException

Returns various information about server.If value is set, it should be an integer of one of the following indexes, and only that information for that index will be returned. See More... 3.3.1
No
get_spawner_type() string locationArray FormatException Gets the spawner type of the specified mob spawner. See More... 3.3.1
Yes
get_whitelisted_players() Array An array of players whitelisted on the server. 3.3.1
No
is_tameable() boolean entityID CastException

BadEntityException

Returns true or false if the specified entity is tameable 3.3.0
Yes
launch_firework() void locationArray, [optionsArray] FormatException Launches a firework. The location array specifies where it is launched from, and the options array is an associative array described below. All parameters in the associative array are optional, and default to the specified values if not set. The default options being set will make it look like a normal firework, with a white explosion. See More... 3.3.1
Yes
make_effect() void xyzArray, effect, [radius] CastException

FormatException

Plays the specified effect (sound effect) at the given location, for all players within the radius (or 64 by default). The effect can be one of the following: BOW_FIRE, CLICK1, CLICK2, DOOR_TOGGLE, EXTINGUISH, RECORD_PLAY, GHAST_SHRIEK, GHAST_SHOOT, BLAZE_SHOOT, SMOKE, STEP_SOUND, POTION_BREAK, ENDER_SIGNAL, ZOMBIE_CHEW_WOODEN_DOOR, ZOMBIE_CHEW_IRON_DOOR, ZOMBIE_DESTROY_DOOR, or MOBSPAWNER_FLAMES. Additional data can be supplied with the syntax EFFECT:DATA. The RECORD_PLAY effect takes the item id of a disc as data, STEP_SOUND takes a blockID and SMOKE takes a direction bit (4 is upwards). 3.1.3
Yes
material_info() array int CastException

FormatException

Returns an array of info about the material. 3.3.1
Yes
max_stack_size() integer itemType
itemArray
CastException

FormatException

Given an item type, returns the maximum allowed stack size. This method will accept either a single data value (i.e. 278) or an item array like is returned from pinv(). Additionally, if a single value, it can also be in the old item notation (i.e. '35:11'), though for the purposes of this function, the data is unneccesary. 3.3.0
No
send_texturepack() void player, url PlayerOfflineException Sends a texturepack URL to the player's client. If the client has not been requested to change textures in the past, they will recieve a confirmation dialog before downloading and switching to the new pack. Clients that ignore server textures will not recieve the request, so this function will not affect them. 3.3.1
Yes
set_entity_health() void entityID, healthPercent CastException

BadEntityException
RangeException

Sets the specified entity's health as a percentage, where 0 kills it and 100 gives it full health. An exception is thrown if the entityID doesn't exist or isn't a LivingEntity. 3.3.0
Yes
set_ip_banned() void address, banned If banned is true, address is added to banned-ips.txt, if false, the address is removed. 3.3.1
Yes
set_spawner_type() void locationArray, type FormatException Sets the mob spawner type at the location specified. If the location is not a mob spawner, or if the type is invalid, a FormatException is thrown. The type may be one of either DROPPED_ITEM, EXPERIENCE_ORB, PAINTING, ARROW, SNOWBALL, FIREBALL, SMALL_FIREBALL, ITEM_FRAME, WITHER_SKULL, WITHER, BAT, WITCH, ENDER_PEARL, ENDER_SIGNAL, THROWN_EXP_BOTTLE, PRIMED_TNT, FALLING_BLOCK, MINECART, BOAT, CREEPER, SKELETON, SPIDER, GIANT, ZOMBIE, SLIME, GHAST, PIG_ZOMBIE, ENDERMAN, CAVE_SPIDER, SILVERFISH, BLAZE, MAGMA_CUBE, ENDER_DRAGON, PIG, SHEEP, COW, CHICKEN, SQUID, WOLF, MUSHROOM_COW, SNOWMAN, OCELOT, IRON_GOLEM, VILLAGER, HORSE, LEASH_HITCH, ENDER_CRYSTAL, SPLASH_POTION, EGG, FISHING_HOOK, LIGHTNING, WEATHER, PLAYER, COMPLEX_PART, FIREWORK, MINECART_CHEST, MINECART_FURNACE, MINECART_TNT, MINECART_HOPPER, MINECART_MOB_SPAWNER, MINECART_COMMAND, or UNKNOWN 3.3.1
Yes
shutdown_server() void Shuts down the minecraft server instance. 3.3.1
Yes
spawn_mob() array mobType, [qty], [location] CastException

RangeException
FormatException
PlayerOfflineException
InvalidWorldException

Spawns qty mob of one of the following types at location. qty defaults to 1, and location defaults to the location of the player. An array of the entity IDs spawned is returned. See More... 3.1.2
Yes
tame_mob() void [player], entityID UntameableMobException

CastException
BadEntityException

Tames the entity specified to the player. Wolves and ocelots are supported. Offline players are supported, but this means that partial matches are NOT supported. You must type the players name exactly. Setting the player to null will untame the mob. If the entity doesn't exist, nothing happens. 3.3.0
Yes

Performance

This class provides functions for hooking into CommandHelper's powerful Performance measuring. To use the functions, you must have allow-profiling option set to true in your preferences file.

Function Name Returns Arguments Throws Description Since Restricted
enable_performance_logging() void boolean SecurityException Enables performance logging. The allow-profiling option must be set to true in your preferences file, and play-dirty mode must be active. If allow-profiling is set to false, a SecurityException is thrown. The debug filters are used by the performance logger, if you choose to filter through the events. See the documenation for more details on performance logging. 3.3.0
Yes

Permissions

Provides access to the server's underlying permissions system. Permissions functionality is only as good as the management system in place, however, and so not all functions may be supported on a given system.

Function Name Returns Arguments Throws Description Since Restricted
has_permission() boolean [player], permissionName InsufficientPermissionException

PlayerOfflineException

Using the built in permissions system, checks to see if the player has a particular permission. This is simply passed through to the permissions system. This function does not throw a PlayerOfflineException, because it works with offline players, but that means that names must be an exact match. If you notice, this function isn't restricted. However, it IS restricted if the player attempts to check another player's permissions. If run from the console, will always return true. 3.3.0
No

Persistence

Allows scripts to store data from execution to execution. See the guide on persistence for more information. In all the functions, you may send multiple arguments for the key, which will automatically be concatenated with a period (the namespace separator). No magic happens here, you can put periods yourself, or combine manually namespaced values or automatically namespaced values with no side effects.

Function Name Returns Arguments Throws Description Since Restricted
clear_value() void [namespace, ...,] key IOException

FormatException

Completely removes a value from storage. Calling has_value(key) after this call will return false. 3.3.0
Yes
get_value() Mixed [namespace, ...,] key IOException

FormatException

Returns a stored value stored with store_value. If the key doesn't exist in storage, null is returned. On a more detailed note: If the value stored in the persistence database is not actually a construct, then null is also returned. 3.0.2
Yes
get_values() array name[, space, ...] IOException

FormatException

Returns all the values in a particular namespace as an associative array(key: value, key: value). Only full namespace matches are considered, so if the key 'users.data.username.hi' existed in the database, and you tried get_values('users.data.user'), nothing would be returned. The last segment in a key is also considered a namespace, so 'users.data.username.hi' would return a single value (in this case).
(Examples...)
3.3.0
Yes
has_value() boolean [namespace, ...,] key IOException

FormatException

Returns whether or not there is data stored at the specified key in the Persistence database. 3.1.2
Yes
store_value() void [namespace, ...,] key, value FormatException

IOException
FormatException

Allows you to store a value, which can then be retrieved later. key must be a string containing only letters, numbers, underscores. Periods may also be used, but they form a namespace, and have special meaning. (See get_values()) 3.0.2
Yes

PlayerManagement

This class of functions allow players to be managed

Function Name Returns Arguments Throws Description Since Restricted
all_players() array [world] InvalidWorldException Returns an array of all the player names of all the online players on the server, if world is given only the name of the players in this world will be returned. 3.0.1
Yes
get_compass_target() array [player] PlayerOfflineException Gets the compass target of the specified player 3.3.0
Yes
get_list_name() string [player] PlayerOfflineException Returns the list name of the specified player, or the current player if none specified. 3.3.1
Yes
get_offline_players() array Returns an array of every player who has played on this server.
(Examples...)
3.3.1
Yes
get_peffect() array [player] PlayerOfflineException Returns an array of effects that are currently active on a given player. The array will be full of playerEffect objects, which contain three fields, "id", "strength", "seconds" remaining, and whether the effect is "ambient". 3.3.1
Yes
get_pflyspeed() double [player] PlayerOfflineException

FormatException

Gets the players speed. The speed must be between -1 or 1 3.3.1
Yes
get_player_from_entity_id() string entityID CastException Given an entity ID that represents a player, returns that player's name, or null if the entity ID isn't a player's entity ID. 3.3.1
Yes
get_pwalkspeed() double [player] PlayerOfflineException

FormatException

Gets the players speed. The speed must be between -1 or 1 3.3.1
Yes
give_pexp() void [player], exp PlayerOfflineException

CastException

Gives the player the specified amount of xp. 3.3.0
Yes
pbanned() boolean player Returns whether or not this player is banned. Note that this will work with offline players, but the name must be exact. At this time, this function only works with the vanilla ban system. If you use a third party ban system, you should instead run the command for that plugin instead. 3.3.0
Yes
pbed_location() array [playerName] Returns an array of x, y, z, coords of the bed of the player specified, or the player running the command otherwise.The array returned will also include the bed's world in index 3 of the array. This is set when a player sleeps or by set_pbed_location. 3.3.1
Yes
pcursor() array [player], [array] PlayerOfflineException

RangeException
FormatException
CastException
PluginInternalException

Returns an array with the (x, y, z, world) coordinates of the block the player has highlighted in their crosshairs. If player is omitted, the current player is used. If the block is too far, a RangeException is thrown. An array of ids to be considered transparent can be supplied, otherwise only air will be considered transparent. Providing an empty array will cause air to be considered a potential target, allowing a way to get the block containing the player's head.
(Examples...)
3.0.2
Yes
pexp() int [player] CastException

PlayerOfflineException

Gets the experience of a player within this level, as a percentage, from 0 to 99. (100 would be next level, therefore, 0.) 3.1.3
Yes
pfacing() mixed F
yaw, pitch
player, F
player, yaw, pitch
player
<none>
PlayerOfflineException

RangeException
CastException

Sets the direction the player is facing. See More... 3.1.3
Yes
pfirst_played() int [player] Returns the time this player first logged onto this server, or 0 if they never have. This will not throw a PlayerOfflineException, so the name must be exact.
(Examples...)
3.3.1
Yes
pfood() int [player] PlayerOfflineException Returns the player's current food level. 3.1.3
Yes
pget_time() int [player] PlayerOfflineException Returns the time of the specified player, as an integer from 0 to 24000-1 3.3.1
Yes
pgroup() array [playerName] PlayerOfflineException Returns an array of the groups a player is in. If playerName is omitted, the current player is used. 3.0.1
Yes
phas_flight() boolean [player] PlayerOfflineException Returns whether or not the player has the ability to fly 3.3.1
Yes
phas_played() boolean player Returns whether the given player has ever been on this server. This will not throw a PlayerOfflineException, so the name must be exact.
(Examples...)
3.3.1
Yes
phunger() int [player] PlayerOfflineException Returns the player's hunger level 3.3.1
Yes
pinfo() mixed [pName], [value] PlayerOfflineException

RangeException
CastException

Returns various information about the player specified, or the current player if no argument was given. See More... 3.1.0
Yes
pisop() boolean [player] PlayerOfflineException Returns whether or not the specified player (or the current player if not specified) is op 3.3.0
Yes
pkick() void [playerName], [message] PlayerOfflineException Kicks the specified player, with an optional message. If no message is specified, "You have been kicked" is used. If no player is specified, the current player is used, with the default message. 3.1.0
Yes
pkill() void [playerName] PlayerOfflineException Kills the specified player, or the current player if it is omitted 3.0.1
Yes
plast_played() int [player] Returns the time this player was last seen on this server, or 0 if they never were. This will not throw a PlayerOfflineException, so the name must be exact.
(Examples...)
3.3.1
Yes
player() string [playerName] PlayerOfflineException Returns the full name of the partial Player name specified or the Player running the command otherwise. If the command is being run from the console, then the string '~console' is returned. If the command came from a CommandBlock, the block's name prefixed with # is returned. If the command is coming from elsewhere, returns a string chosen by the sender of this command (or null). Note that most functions won't support console or block names (they'll throw a PlayerOfflineException), but you can use this to determine where a command is being run from. 3.0.1
No
players_in_radius() array [location array], distance CastException

FormatException
PlayerOfflineException

Returns an array of all the player names of all the online players within the given radius 3.3.1
Yes
plevel() int [player] CastException

PlayerOfflineException

Gets the player's level. 3.1.3
Yes
ploc() array [playerName] PlayerOfflineException Returns an array of x, y, z coords of the player specified, or the player running the command otherwise. Note that the y coordinate is in relation to the block the player is standing on. The array returned will also include the player's world. 3.0.1
Yes
pmode() string [player] PlayerOfflineException Returns the player's game mode. It will be one of SURVIVAL, CREATIVE, or ADVENTURE. 3.1.3
Yes
ponfire() int [player] PlayerOfflineException Returns the number of ticks remaining that this player will be on fire for. If the player is not on fire, 0 is returned, which incidentally is false. 3.3.0
Yes
ponline() boolean player Returns whether or not the specified player is online. Note that the name must match exactly, but it will not throw a PlayerOfflineException if the player is not online, or if the player doesn't even exist. 3.3.0
Yes
preset_time() void [player] InvalidWorldException

PlayerOfflineException

Resets the time of the player to the time of the world. 3.3.1
Yes
psaturation() double [player] RangeException

PlayerOfflineException

Returns the player's saturation level 3.3.1
Yes
psend_block_change() void [player], locationArray, itemID FormatException

PlayerOfflineException

Changes a block, but only temporarily, and only for the specified player. This can be used to "fake" blocks for a player. ItemID is in the 1[:1] data format. 3.3.1
Yes
pset_flight() void [player], flight PlayerOfflineException Sets whether or not this player is allowed to fly DEPRECATED(use set_pflight instead) 3.3.1
Yes
pset_time() void [player], time, [relative] PlayerOfflineException

FormatException

Sets the time of a given player. Relative defaults to false, but if true, the time will be an offset and the player's time will still progress with the world. Otherwise it will be locked and should be a number from 0 to 24000, else it is modulo scaled. Alternatively, common time notation (9:30pm, 4:00 am) is acceptable, and convenient english mappings also exist:
  • afternoon = 8000
  • dawn = 22500
  • day = 2000
  • dusk = 13500
  • earlymorning = 20000
  • evening = 12000
  • midday = 6000
  • midnight = 18000
  • morning = 0
  • night = 14000
  • noon = 6000
  • sunrise = 23000
  • sunset = 13000
DEPRECATED(use set_ptime instead)
3.3.1
Yes
ptarget_space() [player] PlayerOfflineException Returns the "target space" that the player is currently targetting. This is the "space" where if they placed a block (and were close enough), it would end up going. 3.3.1
Yes
ptexp() int [player] CastException

PlayerOfflineException

Gets the total experience of a player. 3.1.3
Yes
pvehicle() mixed [player] PlayerOfflineException Returns ID of vehicle which player is in or null if player is outside the vehicle 3.3.1
Yes
pvehicle_leave() boolean [player] PlayerOfflineException Leave vehicle by player or return false if player is outside the vehicle 3.3.1
Yes
pwhitelisted() boolean player Returns whether or not this player is whitelisted. Note that this will work with offline players, but the name must be exact. 3.3.0
Yes
pworld() string [playerName] PlayerOfflineException Gets the world of the player specified, or the current player, if playerName isn't specified. 3.1.0
Yes
reset_display_name() void [playerName] PlayerOfflineException Resets a player's display name to their real name. If playerName isn't specified, defaults to the player running the command. 3.1.2
Yes
set_compass_target() array [player], locationArray PlayerOfflineException

FormatException

Sets the player's compass target, and returns the old location. 3.3.0
Yes
set_display_name() void playerName, newDisplayName
newDisplayName
PlayerOfflineException Sets a player's display name. If the second usage is used, it sets the display name of the player running the command. See reset_display_name also. playerName, as well as all CommandHelper commands expect the player's real name, not their display name. 3.1.2
Yes
set_list_name() void [player], [listName] PlayerOfflineException

LengthException
FormatException

Sets the player's list name. The name cannot be longer than 16 characters, but colors are supported. Setting the name to null resets it. If the name specified is already taken, a FormatException is thrown, and if the length of the name is greater than 16 characters, a LengthException is thrown. 3.3.1
Yes
set_pbanned() void player, isBanned Sets the ban flag of the specified player. Note that this will work with offline players, but the name must be exact. At this time, this function only works with the vanilla ban system. If you use a third party ban system, you should instead run the command for that plugin instead. 3.3.0
Yes
set_pbed_location() boolean [player], locationArray
[player], x, y, z
CastException

LengthException
PlayerOfflineException
FormatException

Sets the location of the bed of the player to the specified coordinates. If player is omitted, the current player is used. 3.3.1
Yes
set_peffect() boolean player, potionID, strength, [seconds], [ambient] PlayerOfflineException

CastException
RangeException

Effect is 1-23. Seconds defaults to 30. If the potionID is out of range, a RangeException is thrown, because out of range potion effects cause the client to crash, fairly hardcore. See http://www.minecraftwiki.net/wiki/Potion_effects for a complete list of potions that can be added. To remove an effect, set the seconds to 0. Strength is the number of levels to add to the base power (effect level 1). Ambient takes a boolean of whether the particles should be less noticeable. The function returns true if the effect was added or removed as desired, and false if it wasn't (however, this currently only will happen if an effect is attempted to be removed, yet isn't already on the player).
(Examples...)
3.3.0
Yes
set_pexp() void [player], xp CastException

PlayerOfflineException

Sets the experience of a player within the current level, as a percentage, from 0 to 100. 3.1.3
Yes
set_pflight() void [player], flight PlayerOfflineException Sets whether or not this player is allowed to fly 3.3.1
Yes
set_pflyspeed() void [player], speed PlayerOfflineException

RangeException
CastException

Sets players fly speed. The speed must be between -1 or 1 3.3.1
Yes
set_pfood() void [player], level PlayerOfflineException

CastException

Sets the player's food level. This is an integer from 0-? 3.1.3
Yes
set_phealth() void [player], health CastException

RangeException
PlayerOfflineException

Sets the player's health. Health should be a double between 0 and their max health. 3.2.0
Yes
set_phunger() void [player], hunger RangeException

PlayerOfflineException
CastException

Sets a player's hunger level 3.3.1
Yes
set_plevel() void [player], level CastException

PlayerOfflineException

Sets the level of a player. 3.1.3
Yes
set_ploc() boolean [player], locationArray
[player], x, y, z
CastException

LengthException
PlayerOfflineException
FormatException

Sets the location of the player to the specified coordinates. If the coordinates are not valid, or the player was otherwise prevented from moving, false is returned, otherwise true. If player is omitted, the current player is used. Note that 1 is automatically added to the y component, which means that sending a player to x, y, z coordinates shown with F3 will work as expected, instead of getting them stuck inside the floor. 3.1.0
Yes
set_pmode() void [player], mode PlayerOfflineException

FormatException

Sets the player's game mode. mode must be one of: SURVIVAL, CREATIVE, or ADVENTURE 3.1.3
Yes
set_ponfire() void [player], ticks PlayerOfflineException

CastException

Sets the player on fire for the specified number of ticks. If a boolean is given for ticks, false is 0, and true is 20. 3.3.0
Yes
set_psaturation() void [player], saturation RangeException

PlayerOfflineException
CastException

3.3.1
Yes
set_ptexp() void [player], xp CastException

PlayerOfflineException

Sets the total experience of a player. 3.1.3
Yes
set_ptime() void [player], time, [relative] PlayerOfflineException

FormatException

Sets the time of a given player. Relative defaults to false, but if true, the time will be an offset and the player's time will still progress with the world. Otherwise it will be locked and should be a number from 0 to 24000, else it is modulo scaled. Alternatively, common time notation (9:30pm, 4:00 am) is acceptable, and convenient english mappings also exist:
  • afternoon = 8000
  • dawn = 22500
  • day = 2000
  • dusk = 13500
  • earlymorning = 20000
  • evening = 12000
  • midday = 6000
  • midnight = 18000
  • morning = 0
  • night = 14000
  • noon = 6000
  • sunrise = 23000
  • sunset = 13000
3.3.1
Yes
set_pvelocity() boolean [player], vector
[player], x, y, z
CastException

PlayerOfflineException
FormatException

Sets a player's velocity. vector must be an associative array with x, y, and z keys defined (if magnitude is set, it is ignored). If the vector's magnitude is greater than 10, the command is cancelled, because the server won't allow the player to move faster than that. A warning is issued, and false is returned if this happens, otherwise, true is returned. 3.3.1
Yes
set_pwalkspeed() void [player], speed PlayerOfflineException

RangeException
CastException

Sets players speed. The speed must be between -1 or 1 3.3.1
Yes
set_pwhitelisted() void player, isWhitelisted Sets the whitelist flag of the specified player. Note that this will work with offline players, but the name must be exact. 3.3.0
Yes

PluginMeta

This class contains the functions use to communicate with other plugins and the server in general.

Function Name Returns Arguments Throws Description Since Restricted
fake_incoming_plugin_message() void [player,] channel, message CastException

PlayerOfflineException

Fakes an incoming plugin message from the player. Channel should be a string (the channel name) and message should be a byte_array primitive. Depending on the plugin, these parameters will vary. If message is null an empty byte_array is sent. 3.3.1
Yes
get_registered_channels() array Returns an array of strings containing the channels CommandHelper is listening on. 3.3.1
Yes
is_channel_registered() boolean channel Returns true if commandhelper is listening to the given plugin channel. 3.3.1
Yes
register_channel() void channel PluginChannelException Registers a plugin channel for CommandHelper to listen on. Incoming messages can be inspected by binding to 'plugin_message_received'. 3.3.1
Yes
send_plugin_message() void [player,] channel, message CastException

PlayerOfflineException

Sends a plugin message to the player. Channel should be a string (the channel name) and message should be a byte_array primitive. Depending on the plugin, these parameters will vary. If message is null an empty byte_array is sent. 3.3.1
Yes
unregister_channel() void channel PluginChannelException Unregisters a plugin channel CommandHelper is listening on, if any. 3.3.1
Yes

Recipes

This class of functions allows recipes to be managed.

Function Name Returns Arguments Throws Description Since Restricted
add_recipe() boolean RecipeArray CastException

FormatException

Adds a recipe to the server and returns whether it was added or not. Please read http://wiki.sk89q.com/wiki/CommandHelper/Array_Formatting to see how the recipe array is formatted. 3.3.1
Yes
clear_recipes() Void Clears all recipes. 3.3.1
Yes
get_all_recipes() array Gets all recipes on the server. 3.3.1
Yes
get_recipe_for() array itemArray FormatException Gets all recipes that have a result of the given item. NOTE: Gets all recipes for result item regardless of meta and enchants, althogh the array has correct data. 3.3.1
Yes
reset_recipes() Void Resets all recipes to the default recipes. 3.3.1
Yes

Reflection

This class of functions allows scripts to hook deep into the interpreter itself, and get meta information about the operations of a script. This is useful for debugging, testing, and ultra dynamic scripting. See the guide to reflection on the wiki for more details. In order to make the most of these functions, you should familiarize yourself with the general workings of the language. These functions explore extremely advanced concepts, and should normally not be used; especially if you are not familiar with the language.

Function Name Returns Arguments Throws Description Since Restricted
get_aliases() array Returns an array of the defined alias signatures (The part left of the = sign). 3.3.1
Yes
get_events() array Returns an array of all registered event names. 3.3.1
Yes
get_functions() array Returns an associative array of all loaded functions. The keys of this array are the names of the classes containing the functions (which you know as the sections of the API page), and the values are arrays of the names of the functions within those classes. 3.3.1
Yes
reflect_docs() string
element, docField
FormatException Returns the documentation for an element. There are 4 things that an element might have, and one of these should be passed as the docField argument: type, return, args, description. A valid element is either the name of an ivariable, or a function/proc. For instance, reflect_docs('reflect_docs', 'description') would return what you are reading right now. User defined variables and procs may not have any documentation, in which case null is returned. If the specified argument cannot be found, a FormatException is thrown. If no arguments are passed in, it returns the documentation for reflect_docs, that is, what you're reading right now. 3.3.1
Yes
reflect_pull() mixed param, [args, ...] FormatException

IOException

Returns information about the runtime in a usable format. Depending on the information returned, it may be useable directly, or it may be more of a referential format. See More... 3.3.1
Yes
reflect_value_source() string persistenceKey Returns the source file that this key will store a value to in the Persistence Network. For instance, in your persistence.ini file, if you have the entry "storage.test.**=json:///path/to/file.json", then reflect_value_source('storage.test.testing') would return 'json:///path/to/file.json'. This is useful for debugging, as it will definitively trace back the source/destination of a value. 3.3.1
Yes

Regex

This class provides regular expression functions. For more details, please see the page on regular expressions. Note that all the functions are just passthroughs to the Java regex mechanism. If you need to set a flag on the regex, where the api calls for a pattern, instead send array('pattern', 'flags') where flags is any of i, m, or s. Alternatively, using the embedded flag system that Java provides is also valid. Named captures are also supported if you are using Java 7, otherwise they are not supported.

Function Name Returns Arguments Throws Description Since Restricted
reg_count() int pattern, subject FormatException Counts the number of occurances in the subject.
(Examples...)
3.2.0
No
reg_escape() string arg Escapes arg so that it may be used directly in a regular expression, without fear that it will have special meaning; that is, it escapes all special characters. Use this if you need to use user input or similar as a literal search index.
(Examples...)
3.3.1
No
reg_match() array pattern, subject FormatException Searches for the given pattern, and returns an array with the results. Captures are supported. If the pattern is not found anywhere in the subject, an empty array is returned. The indexes of the array follow typical regex fashion; the 0th element is the whole match, and 1-n are the captures specified in the regex.
(Examples...)
3.2.0
No
reg_match_all() array pattern, subject FormatException Searches subject for all matches to the regular expression given in pattern, unlike reg_match, which just returns the first match.
(Examples...)
3.2.0
No
reg_replace() string pattern, replacement, subject FormatException Replaces any occurances of pattern with the replacement in subject. Back references are allowed.
(Examples...)
3.2.0
No
reg_split() array pattern, subject, [limit] FormatException

CastException

Splits a string on the given regex, and returns an array of the parts. If nothing matched, an array with one element, namely the original subject, is returned. Limit defaults to infinity, but if set, only that number of splits will occur.
(Examples...)
3.2.0
No

ResourceManager

This class contains functions for resource management. This entire class of functions WILL be deprecated at some point in the future, so don't rely too heavily on it.

Function Name Returns Arguments Throws Description Since Restricted
res_create_resource() resource type, [data] CastException

FormatException

Creates a new resource, which is stored in memory. Various functions require resources of certain types, which are created with this function. Barring resources that you intend on keeping around indefinitely, each call to res_create_resource should be paired with a res_free_resource, being careful to catch any exceptions and still calling res_free_resource anyways. Each resource has its own data to create the resource. Type may be one of: XML_DOCUMENT, or STRING_BUILDER 3.3.1
Yes
res_free_resource() void resource CastException

NotFoundException

Frees the given resource. This should ALWAYS be called at some point after creating a resource with res_create_resource, once you are done with the resource. 3.3.1
Yes

SQL

This class of functions provides methods for accessing various SQL servers.

Function Name Returns Arguments Throws Description Since Restricted
query() mixed profile, query, [parameters...] SQLException Executes an SQL query, and returns various data depending on the query type.

See the extended information for more details. See More...

3.3.1
Yes
query_async() void profile, query, [params...], callback CastException Asynchronously makes a query to an SQL server. The profile, query, and params arguments work the same as query(), so see the documentation of that function for details about those parameters. The callback should have the following signature: closure(@contents, @exception){ <code> }. @contents will contain the return value that query would normally return. If @exception is not null, then an exception occurred during the query, and that exception will be passed in. If @exception is null, then no error occured, though @contents may still be null if query() would otherwise have returned null. 3.3.1
Yes

Scheduling

This class contains methods for dealing with time and server scheduling.

Function Name Returns Arguments Throws Description Since Restricted
clear_cron() void [cronID] RangeException

CastException

Clears the previously registered cron job from the registered list. This will prevent the task from running again in the future. If run from within a cron task, the id is optional, and the current task will be prevented from running again in the future. If the ID provided is invalid, a RangeException is thrown. 3.3.1
Yes
clear_task() void [id] CastException

InsufficientArgumentsException

Stops the interval or timeout that is specified. The id can be gotten by storing the integer returned from either set_timeout or set_interval. An invalid id is simply ignored. The clear_task function is more useful for set_timeout, where you may queue up some task to happen in the far future, yet have some trigger to prevent it from happening. ID is optional, but only if called from within a set_interval or set_timeout closure, in which case it defaults to the id of that particular task. 3.3.1
Yes
nano_time() int Returns an arbitrary number based on the most accurate clock available on this system. Only useful when compared to other calls to nano_time(). The return is in nano seconds. See the Java API on System.nanoTime() for more information on the usage of this function. 3.1.0
No
set_cron() int cronFormat, closure CastException

FormatException

Sets a task to occur at a regular interval, given a cron style interval. This allows for an

easier way to specify that a task should happen, for instance, every hour on the hour. Unlike set_interval, this uses absolute wall clock time, not relative times. The task id is returned, so it can be cleared later with clear_cron if needed. If clear_cron is run from within the task itself, the id is optional. See more information for a detailed description of cron format. See More...

3.3.1
Yes
set_interval() int timeInMS, [initialDelayInMS,] closure CastException Sets a task to run every so often. This works similarly to set_timeout, except the task will automatically re-register itself to run again. Note that the resolution of the time is in ms, however, the server will only have a resolution of up to 50 ms, meaning that a time of 1-50ms is essentially the same as 50ms. The inital delay defaults to the same thing as timeInMS, that is, there will be a pause between registration and initial firing. However, this can be set to 0 (or some other number) to adjust how long of a delay there is before it begins. 3.3.1
Yes
set_timeout() int timeInMS, closure CastException Sets a task to run in the specified number of ms in the future. The task will only run once. Note that the resolution of the time is in ms, however, the server will only have a resolution of up to 50 ms, meaning that a time of 1-50ms is essentially the same as 50ms. 3.3.1
Yes
simple_date() mixed format, [time, [timezone]] CastException

FormatException

Returns a date of the current time (or the time specified) in the format you give. See More...
(Examples...)
3.3.1
No
time() int Returns the current unix time stamp, in milliseconds. The resolution of this is not guaranteed to be extremely accurate. If you need extreme accuracy, use nano_time() 3.1.0
No

Scoreboards

A class of functions for manipulating the server scoreboard.

Function Name Returns Arguments Throws Description Since Restricted
create_objective() void name, [criteria, [scoreboard]] LengthException

ScoreboardException

Adds a new objective to the scoreboard, throwing a ScoreboardException if the name is already in use. The vanilla criteria names are DEATHCOUNT, HEALTH, PLAYERKILLCOUNT, TOTALKILLCOUNT, and DUMMY. You can put anything, but if none of the other values match, 'dummy' will be used. Those values which are not 'dummy' are server-managed. Throws a LengthException if the name is more than 16 characters. Scoreboard defaults to 'main' if not given. 3.3.1
Yes
create_scoreboard() void name ScoreboardException Creates a new scoreboard identified by the given name, and stores it internally for later use. Throws an exception if the name is already in use. 3.3.1
Yes
create_team() void name, [scoreboard] LengthException

ScoreboardException

Adds a new team to the scoreboard, throws a ScoreboardException if a team already exists with the given name. Throws a LengthException if the team name is more than 16 characters. Scoreboard defaults to 'main' if not given. 3.3.1
Yes
get_objectives() array [scoreboard], [criteria] ScoreboardException Returns an array of arrays about the objectives on the given scoreboard, which defaults to 'main' if not given. If criteria is given, only objectives with that criteria will be returned. The arrays contain the keys name, displayname, slot, modifiable, and criteria. 3.3.1
Yes
get_pscore() int objectiveName, player, [scoreboard] ScoreboardException Returns the player's score for the given objective. Works for offline players, so the name must be exact. Scoreboard defaults to 'main' if not given. 3.3.1
Yes
get_pscoreboard() scoreboard player PlayerOfflineException

ScoreboardException

Returns the id of the scoreboard assigned to a player. If it is not already cached, it will be added using the player's name. Using this method, it should be possible to import scoreboards created by other plugins. 3.3.1
Yes
get_scoreboards() array Returns an array of the registered scoreboard ID's. The special scoreboard 'main' represents the server's main scoreboard which can be managed by the vanilla /scoreboard command. 3.3.1
Yes
get_teams() array [scoreboard] ScoreboardException Returns an array of arrays about the teams on the given scoreboard, which defaults to 'main' if not given. The arrays contain the keys name, displayname, prefix, suffix, size, options, and players. 3.3.1
Yes
remove_objective() void objectivename, [scoreboard] ScoreboardException Unregisters an objective from the scoreboard. Scoreboard defaults to 'main' if not given. 3.3.1
Yes
remove_scoreboard() void scoreboard, [nullify] ScoreboardException Stops tracking the given scoreboard, unless it is 'main', because that never goes away. If nullify is true (defaults to true), all scores, teams, and objectives will be cleared, and all tracked players currently online will be switched to the main scoreboard, essentially removing all references to the board so it can be garbage-collected. 3.3.1
Yes
remove_team() void teamname, [scoreboard] ScoreboardException Unregisters a team from the scoreboard. Scoreboard defaults to 'main' if not given. 3.3.1
Yes
reset_all_pscores() void player, [scoreboard] ScoreboardException Resets all scores for a player tracked by the given scoreboard. This means they will not be show up on any displays. Scoreboard defaults to 'main' if not given. 3.3.1
Yes
set_objective_display() void objectiveName, array, [scoreboard]
objectiveName, displayname, [scoreboard]
FormatException

LengthException
ScoreboardException

Sets the display name and/or slot of the given objective. If arg 2 is not an array, it is assumed to be the displayname, otherwise arg 2 should be an array with keys 'displayname' and/or 'slot', affecting their respective properties. Null name resets it to the actual name, and null slot removes it from all displays. Slot can be one of: BELOW_NAME, PLAYER_LIST, or SIDEBAR. Displayname can be a max of 32 characters, otherwise it throws a LengthException. Scoreboard defaults to 'main' if not given. 3.3.1
Yes
set_pscore() void objectiveName, player, int, [scoreboard] LengthException

ScoreboardException

Sets the player's score for the given objective. Works for offline players, so the name must be exact. Alternatively, you can set scores for fake players to create custom displays, but the 16 character name limit still applies. Scoreboard defaults to 'main' if not given. 3.3.1
Yes
set_pscoreboard() void player, [scoreboard] PlayerOfflineException

ScoreboardException

Sets the scoreboard to be used by a player. The scoreboard argument is the id of a registered scoreboard. Scoreboard defaults to 'main' if not given. 3.3.1
Yes
set_team_display() void teamName, array, [scoreboard]
teamName, displayname, [scoreboard]
LengthException

ScoreboardException

Sets the display name, prefix, and/or suffix of the given team. If arg 2 is not an array, it is assumed to be the displayname, otherwise arg 2 should be an array with keys 'displayname', 'prefix', and/or 'suffix', affecting their respective properties. Null name resets it to the actual name, and null prefix or suffix removes it from all displays. Displayname can be a max of 32 characters, prefix and suffix can only be 16, otherwise a LengthException is thrown. Scoreboard defaults to 'main' if not given. 3.3.1
Yes
set_team_options() void teamName, array, [scoreboard] ScoreboardException

FormatException

Sets various options about the team from an array, checking for keys 'friendlyfire' and 'friendlyinvisibles'. Scoreboard defaults to 'main' if not given. 3.3.1
Yes
team_add_player() void teamName, player, [scoreboard] LengthException

ScoreboardException

Adds a player to a team, given the team exists. Offline players can be added, so the name must be exact. Alternatively, this allows you to add fake players, but names can still only be 16 characters. The player will be removed from any other team on the same scoreboard. Scoreboard defaults to 'main' if not given. 3.3.1
Yes
team_remove_player() boolean teamname, player, [scoreboard] ScoreboardException Attempts to remove a player from a team, and returns true if successful, for false if the player was not part of the team.Scoreboard defaults to 'main' if not given. 3.3.1
Yes

StringHandling

These class provides functions that allow strings to be manipulated

Function Name Returns Arguments Throws Description Since Restricted
cc() string args... The cousin to concat, this function does some magic under the covers to remove the auto-concatenation effect in bare strings. Take the following example: cc(bare string) -> barestring
(Examples...)
3.3.1
No
char_from_unicode() string unicode CastException

RangeException

Returns the unicode character for a given unicode value. This is meant for dynamic input that needs converting to a unicode character, if you're hardcoding it, you should just use '\u1234' syntax instead, however, this is the dynamic equivalent of the \u string escape, so '\u1234' == char_from_unicode(parse_int('1234', 16)). Despite the name, certain unicode escapes may return multiple characters, so there is no guarantee that length(char_from_unicode(@val)) will equal 1.
(Examples...)
3.3.1
No
concat() string var1, [var2...] Concatenates any number of arguments together, and returns a string
(Examples...)
3.0.1
No
length() int str
array
Returns the character length of str, if the value is castable to a string, or the length of the array, if an array is given
(Examples...)
3.1.2
No
levenshtein() int string1, string2 Returns the levenshtein distance of two character sequences. For instance, "123" and "133" would have a string distance of 1, while "123" and "123" would be 0, since they are the same string.
(Examples...)
3.3.1
No
parse_args() array string, [useAdvanced] Parses string into an array, where string is a space seperated list of arguments. Handy for turning $ into a usable array of items with which to script against. Extra spaces are ignored, so you would never get an empty string as an input. useAdvanced defaults to false, but if true, uses a basic argument parser that supports quotes for allowing arguments with spaces.
(Examples...)
3.0.1
No
replace() string subject, search, replacement Replaces all instances of 'search' with 'replacement' in 'subject'
(Examples...)
3.0.1
No
sconcat() string var1, [var2...] Concatenates any number of arguments together, but puts a space between elements
(Examples...)
3.0.1
No
split() array split, string, [limit] CastException Splits a string into parts, using the split as the index. Though it can be used in every single case you would use reg_split, this does not use regex, and therefore can take a literal split expression instead of needing an escaped regex, and *may* perform better than the regex versions, as it uses an optimized tokenizer split, instead of Java regex. Limit defaults to infinity, but if set, only that number of splits will occur.
(Examples...)
3.3.1
No
sprintf() string formatString, parameters...
formatString, array(parameters...)
FormatException

InsufficientArgumentsException
CastException

Returns a string formatted to the given formatString specification, using the parameters passed in. The formatString should be formatted according to this standard, with the caveat that the parameter types are automatically cast to the appropriate type, if possible. Calendar/time specifiers, (t and T) expect an integer which represents unix time, but are otherwise valid. All format specifiers in the documentation are valid.
(Examples...)
3.3.1
No
string_append() void resource, toAppend... CastException Appends any number of values to the underlying string builder. This is much more efficient than doing normal concatenation with a string when building a string in a loop. The underlying resource may be converted to a string via a cast, string(@res).
(Examples...)
3.3.1
Yes
string_from_bytes() string byte_array, [encoding] CastException

FormatException

Returns a new string, given the byte array encoding provided. The encoding defaults to UTF-8, but may be specified. A FormatException is thrown if the encoding type is invalid. 3.3.1
No
string_get_bytes() byte_array string, [encoding] CastException

FormatException

Returns this string as a byte_array, encoded using the specified encoding, or UTF-8 if no encoding is specified. Valid encodings are the encoding types that java supports. If the encoding is invalid, a FormatException is thrown. 3.3.1
No
string_position() int haystack, needle NullPointerException Finds the numeric position of the first occurence of needle in haystack. haystack is the string to search in, and needle is the string to search with. Returns the position of the needle (starting with 0) or -1 if the string is not found at all.
(Examples...)
3.3.1
No
substr() string str, begin, [end] RangeException

CastException

Returns a substring of the given string str, starting from index begin, to index end, or the end of the string, if no index is given. If either begin or end are out of bounds of the string, an exception is thrown. substr('hamburger', 4, 8) returns "urge", substr('smiles', 1, 5) returns "mile", and substr('lightning', 5) returns "ning". See also length().
(Examples...)
3.1.2
No
to_lower() string str Returns an all lower case version of str
(Examples...)
3.1.2
No
to_upper() string str Returns an all caps version of str
(Examples...)
3.1.2
No
trim() string s Returns the string s with leading and trailing whitespace cut off
(Examples...)
3.0.1
No
triml() string s Returns the string s with leading whitespace cut off
(Examples...)
3.3.1
No
trimr() string s Returns the string s with trailing whitespace cut off
(Examples...)
3.3.1
No
unicode_from_char() int character CastException

RangeException

Returns the unicode code point for a given character. The character is a string, but it should only be 1 code point character (which may be length(@character) == 2).
(Examples...)
3.3.1
No

Threading

This experimental and private API is subject to removal, or incompatible changes, and should not be yet heavily relied on in normal development.

Function Name Returns Arguments Throws Description Since Restricted
x_get_current_thread() string Returns the thread id (thread name) of the currently running thread.
(Examples...)
3.3.1
Yes
x_new_thread() void id, closure CastException Creates a new thread, named id, and runs the closure on that thread. Note that many operations are not advisable to be run on other threads, and unless otherwise stated, functions are generally not thread safe. You can use x_run_on_main_thread_later() and x_run_on_main_thread_now() to ensure operations will be run correctly, however.
(Examples...)
0.0.0
Yes
x_run_on_main_thread_later() void closure Runs the closure on the main thread later. If the function call is itself being run from the main thread, then the function still will not block, but it is not an error to call this from the main thread. If an exception is thrown from the closure, it is handled using the uncaught exception handler. 3.3.1
Yes
x_run_on_main_thread_now() mixed closure Runs the closure on the main thread now, blocking the current thread until it is finished. If the function call is itself being run from the main thread, then the function still will block as expected; it is not an error to call this from the main thread. Unlike running on the main thread later, if the underlying code throws an exception, it is thrown as a normal part of the execution. If the closure returns a value, it is returned by x_run_on_main_thread_now. 3.3.1
Yes

Weather

Provides functions to control the weather

Function Name Returns Arguments Throws Description Since Restricted
has_storm() boolean [world] InvalidWorldException Returns whether the world (defaults to player's world) has a storm. 3.3.1
No
has_thunder() boolean [world] InvalidWorldException Returns whether the world (defaults to player's world) has thunder. 3.3.1
No
lightning() int strikeLocArray, [safe]
x, y, z, [safe]
CastException

LengthException
InvalidWorldException
FormatException

Makes lightning strike at the x y z coordinates specified in the array(x, y, z). Safe defaults to false, but if true, lightning striking a player will not hurt them. Returns the entityID of the lightning bolt. 3.0.1
Yes
set_thunder() void boolean, [world], [int] InvalidWorldException

CastException

Sets whether or not the weather can have thunder. The third argument can specify how long the thunder should last. 3.3.1
Yes
storm() void isStorming, [world], [int] CastException

InvalidWorldException

Creates a (rain) storm if isStorming is true, stops a storm if isStorming is false. The third argument allows setting how long this weather setting will last. 3.0.1
Yes

Web

Contains various methods to make HTTP requests.

Function Name Returns Arguments Throws Description Since Restricted
http_clear_session_cookies() void cookieJar CastException Clears out "session" cookies, that is cookies that weren't set with an expiration (which translates to 0 in an individual cookie). 3.3.1
No
http_request() void url, callback
url, settings
FormatException Makes an HTTP request to the given url. See More...
(Examples...)
3.3.1
Yes
url_decode() string param Decodes a previously url encoded string.
(Examples...)
3.3.1
No
url_encode() string param URL Encodes the parameter given. This escapes all special characters per the x-www-form-urlencoded format.
(Examples...)
3.3.1
No

World

Provides functions for manipulating a world

Function Name Returns Arguments Throws Description Since Restricted
create_world() void name, [type, environment, [seed, [generator]]] FormatException

CastException

Creates a new world with the specified options. If the world already exists, it will be loaded from disk, and the last 3 arguments may be ignored. name is the name of the world, type is one of NORMAL, FLAT, VERSION_1_1, LARGE_BIOMES, AMPLIFIED and environment is one of NORMAL, NETHER, THE_END. The seed can be an integer, a string (will be the hashcode), or null (will be random int). Generator is the name of a world generator loaded on the server. 3.3.1
Yes
get_chunk_loc() array [location array] FormatException

InsufficientArgumentsException

Returns an array of x, z, world coords of the chunk of either the location specified or the location of the player running the command. 3.3.1
No
get_difficulty() string world InvalidWorldException Returns the difficulty of the world, It will be one of PEACEFUL, EASY, NORMAL, or HARD. 3.3.1
Yes
get_gamerule() mixed world, [gameRule] InvalidWorldException

FormatException

Returns an associative array containing the values of all existing gamerules for the given world. If gameRule is set, the function only returns the value of the specified gamerule, a boolean.gameRule can be COMMANDBLOCKOUTPUT, DODAYLIGHTCYCLE, DOFIRETICK, DOMOBLOOT, DOMOBSPAWNING, DOTILEDROPS, KEEPINVENTORY, MOBGRIEFING, or NATURALREGENERATION. 3.3.1
Yes
get_loaded_chunks() array [world] CastException

FormatException
InvalidWorldException

Gets all currently loaded chunks, in the specified world, or the current players world if not provided. 3.3.1
Yes
get_pitch() void location_from, location_to InvalidWorldException

FormatException

Calculate pitch from one location to another. 3.3.1
Yes
get_pvp() boolean world InvalidWorldException Returns if PVP is allowed in the world. 3.3.1
Yes
get_spawn() array [world] InvalidWorldException

FormatException

Returns a location array for the specified world, or the current player's world, if not specified. 3.3.0
Yes
get_world_time() int [world] InvalidWorldException Returns the time of the specified world, as an integer from 0 to 24000-1 3.3.0
Yes
get_worlds() array Returns a list of all currently loaded worlds. 3.3.1
Yes
get_yaw() void location_from, location_to InvalidWorldException

FormatException

Calculate yaw from one location to another. 3.3.1
Yes
is_slime_chunk() boolean x, z, [world]
locationArray, [world]
CastException

FormatException
InvalidWorldException

Returns if the chunk is a slime spawning chunk, using the specified world, or the current players world if not provided. 3.3.1
Yes
load_chunk() void [world], x, z
[world], locationArray
CastException

FormatException
InvalidWorldException

Loads the chunk, using the specified world, or the current players world if not provided. 3.3.1
Yes
location_shift() void location_from, location_to, distance InvalidWorldException

FormatException
RangeException

Shift from one location to another, by defined distance. 3.3.1
Yes
refresh_chunk() void [world], x, z
[world], locationArray
CastException

FormatException
InvalidWorldException

Resends the chunk data to all clients, using the specified world, or the current players world if not provided. 3.3.0
Yes
regen_chunk() void x, z, [world]
locationArray, [world]
CastException

FormatException
InvalidWorldException

Regenerate the chunk, using the specified world, or the current players world if not provided. Beware that this is destructive! Any data in this chunk will be lost! 3.3.1
Yes
set_difficulty() void [world], difficulty InvalidWorldException

FormatException

Sets the difficulty of the world with the given name, or all worlds if the name is not given. difficulty can be PEACEFUL, EASY, NORMAL, or HARD. 3.3.1
Yes
set_gamerule() void [world], gameRule, value InvalidWorldException

FormatException

Sets the value of the gamerule for the specified world, value is a boolean. If world is not given the value is set for all worlds. gameRule can be COMMANDBLOCKOUTPUT, DODAYLIGHTCYCLE, DOFIRETICK, DOMOBLOOT, DOMOBSPAWNING, DOTILEDROPS, KEEPINVENTORY, MOBGRIEFING, or NATURALREGENERATION. 3.3.1
Yes
set_pvp() void [world], boolean InvalidWorldException Sets if PVP is allowed in the world with the given name, or all worlds if the name is not given. 3.3.1
Yes
set_spawn() void locationArray
[world], x, y, z
InvalidWorldException

CastException
FormatException

Sets the spawn of the world. Note that in some cases, a plugin may set the spawn differently, and this method will do nothing. In that case, you should use the plugin's commands to set the spawn. 3.3.1
Yes
set_world_time() void [world], time InvalidWorldException

FormatException

Sets the time of a given world. Should be a number from 0 to 24000, if not, it is modulo scaled. See More... 3.3.0
Yes
spawn_falling_block() integer location array, id[:type], [vector array ie. array(x, y, z)] FormatException Spawns a falling block of the specified id and type at the specified location, applying vector array as a velocity if given. Values for the vector array are doubles, and 1.0 seems to imply about 3 times walking speed. Gravity applies for y. 3.3.1
Yes
unload_chunk() void [world], x, z
[world], locationArray
CastException

FormatException
InvalidWorldException

Unloads the chunk, using the specified world, or the current players world if not provided. 3.3.1
Yes
unload_world() boolean world, [save] InvalidWorldException Unloads a world, and saves it if save is true (defaults true), and returns whether or not the operation was successful. 3.3.1
Yes
world_info() array world InvalidWorldException Returns an associative array of all the info needed to duplicate the world. The keys are name, seed, environment, generator, and worldtype. 3.3.1
Yes

WorldEdit

Provides various methods for programmatically hooking into WorldEdit and WorldGuard

Function Name Returns Arguments Throws Description Since Restricted
sk_all_regions() array [world] Returns all the regions in all worlds, or just the one world, if specified. 3.2.0
Yes
sk_can_build() boolean [player,] locationArray InvalidPluginException

PlayerOfflineException
FormatException
InvalidWorldException

Returns whether or not player can build at the location, according to WorldGuard. If player is not given, the current player is used. 3.3.1
Yes
sk_current_regions() mixed [player] PlayerOfflineException

PluginInternalException

Returns the list regions that player is in. If no player specified, then the current player is used. If region is found, an array of region names are returned, else an empty array is returned 3.2.0
Yes
sk_pos1() mixed [player], locationArray
[player]
PlayerOfflineException

CastException

Sets the player's point 1, or returns it if the array to set isn't specified. If the location is returned, it is returned as a 4 index array:(x, y, z, world) 3.2.0
Yes
sk_pos2() mixed [player], array
[player]
PlayerOfflineException

CastException

Sets the player's point 2, or returns it if the array to set isn't specified 3.2.0
Yes
sk_region_addmember() void region, [world], [member1]
region, [world], [array(member1, memberN, ...)]
InvalidWorldException

PluginInternalException

Add member(s) to given region. 3.3.1
Yes
sk_region_addowner() void region, [world], [owner1]
region, [world], [array(owner1, ownerN, ...)]
InvalidWorldException

PluginInternalException

Add owner(s) to given region. 3.3.1
Yes
sk_region_check_flag() mixed locationArray, flagName, [player] InvalidWorldException

FormatException
PluginInternalException
NotFoundException

Check state of selected flag in defined location. FlagName should be any supported flag from this list. Player defaults to the current player. 3.3.1
Yes
sk_region_create() void [world], name, array(locationArrayPos1, locationArrayPos2, [[locationArrayPosN]...])
[world], '__global__'
InvalidWorldException

PluginInternalException

Create region of the given name in the given world. You can omit list of points if you want to create a __global__ region. 3.3.1
Yes
sk_region_exists() void [world], name InvalidWorldException Check if a given region exists. 3.3.1
Yes
sk_region_flag() void world, region, flagName, flagValue, [group] InvalidWorldException

PluginInternalException

Add/change/remove flag for selected region. FlagName should be any supported flag from this list. For the flagValue, use types which are supported by WorldGuard. Add group argument if you want to add WorldGuard group flag (read more about group flag types here). Set flagValue as null (and don't set group) to delete the flag from the region. 3.3.1
Yes
sk_region_info() array region, world, [value] PluginInternalException

CastException
RangeException

Given a region name, returns an array of information about that region. See More... 3.2.0
Yes
sk_region_intersect() array world, region1, [array(region2, [regionN...])] PluginInternalException Returns an array of regions names which intersect with defined region. You can pass an array of regions to verify or omit this parameter and all regions in selected world will be checked. 3.2.0
Yes
sk_region_members() array region, world PluginInternalException Returns an array of members of this region. If the world or region cannot be found, a PluginInternalException is thrown. 3.2.0
Yes
sk_region_overlaps() boolean world, region1, array(region2, [regionN...]) PluginInternalException Returns true or false whether or not the specified regions overlap. 3.2.0
Yes
sk_region_owners() array region, world PluginInternalException Returns an array of owners of this region. If the world or region cannot be found, a PluginInternalException is thrown. 3.2.0
Yes
sk_region_remmember() void region, [world], [member1]
region, [world], [array(member1, memberN, ...)]
InvalidWorldException

PluginInternalException

Remove member(s) from given region. 3.3.1
Yes
sk_region_remove() void [world], name InvalidWorldException

PluginInternalException

Remove existed region. 3.3.1
Yes
sk_region_remowner() void region, [world], [owner1]
region, [world], [array(owner1, ownerN, ...)]
InvalidWorldException

PluginInternalException

Remove owner(s) from given region. 3.3.1
Yes
sk_region_rename() void [world], oldName, newName InvalidWorldException

PluginInternalException

Rename the existing region. Other properties of the region, like owners, members, priority, etc are unaffected. 3.3.1
Yes
sk_region_setparent() void world, region, [parentRegion] InvalidWorldException

PluginInternalException

Sets parent region for a given region. 3.3.1
Yes
sk_region_setpriority() void [world], region, priority InvalidWorldException

PluginInternalException

Sets priority for a given region. 3.3.1
Yes
sk_region_update() void [world], name, array(locationArrayPos1, locationArrayPos2, [[locationArrayPosN]...]) InvalidWorldException

PluginInternalException

Updates the location of a given region to the new location. Other properties of the region, like owners, members, priority, etc are unaffected. 3.3.1
Yes
sk_region_volume() int region, world PluginInternalException Returns the volume of the given region in the given world. 3.2.0
Yes
sk_regions_at() mixed Locationarray CastException

PluginInternalException
InsufficientArgumentsException

Returns a list of regions at the specified location. If regions are found, an array of region names are returned, otherwise, an empty array is returned. 3.2.0
Yes
skcb_load() void filename PluginInternalException

IOException
InvalidPluginException

Loads a schematic into the clipboard from file. It will use the directory specified in WorldEdit's config. 3.3.1
Yes
skcb_paste() void location, [ignoreAir], [fastmode], [entities] InvalidWorldException

InvalidPluginException
NotFoundException
RangeException
CastException

Pastes a schematic from the clipboard as if a player was standing at the location. If ignoreAir is true, air blocks from the schematic will not replace blocks in the world. If fastmode is true, the function will use WorldEdit's 'fastmode' to paste. If entities is true, any entities stored in the clipboard will be pasted as well. Both ignoreAir and entities default to false. 3.3.1
Yes
skcb_rotate() void int RangeException

NotFoundException
InvalidPluginException
CastException

Given a multiple of 90, rotates the clipboard by that number. 3.3.1
Yes

Errors in documentation

Please note that this documentation is generated automatically, if you notice an error in the documentation, please file a bug report for the plugin itself! For information on undocumented functions, see this page
There are 612 functions in this API page, 162 of which have examples.





Namespaces

Variants
Actions