Hooks

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:

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().

// 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

Last updated