Script

Class

A handle representation of a script containing its metadata and defined classes.

This can be used to find insights about a script or find a particular function handle.

These should not be stored - they can be arbitrarily graveyarded without any notification by the unloader, in which case this will become a dead spot in memory.

Extends

Object

Modifiers

public final

final PostCompileClass data = skript.compileScript(code, "skript.myscript");
final Script script = skript.loadScript(data);
final Member function = script.getFunction("my_func");
function.run();

final PostCompileClass data = skript.compileScript(code, "skript.myscript");
final Script script = skript.loadScript(data);
skript.runEvent(new MyEvent(), script);

Methods


getSimpleName ()

Method

The simple name of the main class for this script. This will be something in the format script.

Return Type

String

Modifiers

public

// Randomly-generated example
final String string = script.getSimpleName();
assert string.equals(anObject);
assert string.length() == 37;
string.toString();

classes ()

Method

Returns the known classes for this script. This will include the main class and any custom types, etc.

Return Type

Class[]

Modifiers

public

getFunction (String)

Method

Returns a handle for the function with this name. Multiple functions may have the same name, this will return an arbitrary one.

IndexTypeName
1Stringname
Return Type

Member

Modifiers

public

// Randomly-generated example
final Member member = script.getFunction(name);
member.invoke(arguments);
member.run(arguments);
member.run(skript, arguments);

getMembers ()

Method

Returns the structures for all members, used for data collection.

Return Type

Structure[]

Modifiers

public

getPath ()

Method

The path of the main class for this script. This will be something in the format skript.path.to.script

Return Type

String

Modifiers

public

assert script.getPath().startsWith(myPathName);

mainClass ()

Method

Gets the main class of this script, which root-level members occupy. Custom types and other members may be moved to other classes, depending on the compiler used.

This should not be stored - it will prevent the script unloading safely.

Return Type

Class

Modifiers

public

sourceFile ()

Method

Returns the known source file for this script. This may not exist for some implementations.

Return Type

File

Modifiers

public

// Randomly-generated example
final File file = script.sourceFile();
file.getName();
assert file.equals(obj);
assert file.length() == 74;

skriptInstance ()

Method

Returns the Skript runtime that created this script.

Return Type

Skript

Modifiers

public

// Randomly-generated example
final Skript skript = script.skriptInstance();
skript.getCompiler();
assert skript.println(object) == null;
skript.getClass(name);

ownsClass (Class)

Method
No description is available for this element.
IndexTypeName
1Classcls
Return Type

boolean

Modifiers

hasSourceFile ()

Method

Whether this script has a known source file.

Return Type

boolean

Modifiers

public

// Randomly-generated example
assert script.hasSourceFile();

getMemberData ()

Method

Finds source data annotations for members in this script.

Return Type

Collection

Modifiers

public