# Utilities

## Collect

```
[%objects%]
[%objects% as %javatype%]
```

Creates an array containing the specified objects. Specifying a type determines the component type of the resulting array.

{% hint style="info" %}
The brackets in this syntax are literal, not representing an optional group.
{% endhint %}

## Spread

```
...%object%
```

Returns the contents of a single array, iterable, iterator, or stream.

## Array Creation

```
new %javatype%[%integer%]
```

Creates an array of the given type and size. The type may be primitive, which doesn't require an import.

{% hint style="info" %}
The brackets in this syntax are literal, not representing an optional group.
{% endhint %}

## Array Value

```
%array%[%integer%]
```

Represents the value at a certain index of an array.

This value may be read from and written to.

{% hint style="info" %}
The brackets in this syntax are literal, not representing an optional group.
{% endhint %}

## Null

```
null
```

Represents `null` in Java. This is different from Skript's `<none>`.

## Bits

```
[the] (bit %number%|bit(s| range) [from] %number%( to |[ ]-[ ])%number%) of %numbers%
%numbers%'[s] (bit %number%|1¦bit(s| range) [from] %number%( to |[ ]-[ ])%number%)
```

Represents a subset of bits from a number.

This value may be read from and written to.

## Raw Expression

```
[the] raw %objects%
```

Returns the underlying object of an expression.

{% hint style="info" %}
When used with [the expression-expression](https://tpgamesnl.gitbook.io/skript-reflect/advanced/custom-syntax#expression), you can set it to a value, which will change the input value from that argument. This can be used to store data in variables in the calling trigger.

```
import:
	ch.njol.skript.lang.Variable

effect put %objects% in %objects%:
	parse:
		expr-2 is an instance of Variable # to check if the second argument is a variable
		continue
	trigger:
		set raw expr-2 to expr-1
```

{% endhint %}

## Members

```
[the] (fields|methods|constructors) of %objects%
%objects%'[s] (fields|methods|constructors)
```

Returns a list of the fields, methods, or constructors of an object, including their modifiers and parameters.

If you need a list of field or method names without modifier or parameter details, see [Member Names](#member-names).

## Member Names

```
[the] (field|method) names of %objects%
%objects%'[s] (field|method) names
```

Returns a list of the fields or methods of an object.

## Is Instance

```
%objects% (is|are) [a[n]] instance[s] of %javatypes%
%objects% (is not|isn't|are not|aren't) [a[n]] instance[s] of %javatypes%
```

Checks whether objects are instances of the given java types.

## Class reference

```
%javatype%.class
```

Returns a reference to the class from the given java type. Returns an object of type `java.lang.Class`. This expression also supports primitive types, which doesn't require an import.

## Plugin instance

```
[(an|the)] instance of [the] plugin %javatype/string%
```

Returns the instance of the given plugin (either the name as a string, or the plugin class).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tpgamesnl.gitbook.io/skript-reflect/basics/utilities.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
