> For the complete documentation index, see [llms.txt](https://tastycake.gitbook.io/itemscore/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tastycake.gitbook.io/itemscore/how-to-use/the-code/hooks.md).

# Hooks

{% hint style="warning" %}
Not really relevant anymore because of the addition of addons but its still a thing...
{% endhint %}

**First, what is hook?**

hook is like a plugin dependency, you can access its code from your code. Then how to use it in ItemsCore?

First you need to get the .jar of the plugin you want to use and put both on the "hooks" folder in the ItemsCore plugin folder, now what you want to do is to add this line of code for each of your hooks:

```javascript
core.setHook(String, String, String, String) // (String) how you will access it from your code, for example "bla" I will need to use bla.(method here)
// (String) jar name (how to name of the file you put in the hooks folder is called)
// (String) groupId this is the groupId of the plugin (this is the same as adding dependency)
// (String) artifactId (same as using dependency).
```

**How to use the hook?**

to use the hook, enter the hook name (the first string) in the example above its "bla" with the method runMethod().

```javascript
// Hook name instead of "bla"
bla.runMethod(String, Class<?>[], Object[] values) // (String) method name
// (Class<?>[]) the array of the arguments the method takes, for example (test(String) takes String.class) use core.getClassByName() to provide this in this example we will do "core.getClassByName("String")"
// (Object...) provide the value for each argument put , between each value like parsing another Object
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://tastycake.gitbook.io/itemscore/how-to-use/the-code/hooks.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.
