-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHook.java
More file actions
53 lines (44 loc) · 1.26 KB
/
Hook.java
File metadata and controls
53 lines (44 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package fr.traqueur.recipes.api.hook;
import fr.traqueur.recipes.api.domains.Ingredient;
import fr.traqueur.recipes.impl.hook.Hooks;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.ArrayList;
import java.util.List;
/**
* Hooks are used to create custom ingredients
*/
public interface Hook {
/**
* The list of hooks
*/
List<Hook> HOOKS = new ArrayList<>(List.of(Hooks.values()));
/**
* Add a new hook
* @param hook The hook to add
*/
static void addHook(Hook hook) {
HOOKS.add(hook);
}
/**
* Get a plugin name of the hook
* @return The hook's plugin name
*/
String getPluginName();
/**
* Get an ingredient from the hook
* @param data The data of the ingredient
* @param sign The sign of the ingredient
* @return The ingredient
*/
Ingredient getIngredient(String data, Character sign);
/**
* Check if the plugin is enabled
* @param plugin The plugin which use the API
* @return If the plugin is enabled
*/
default boolean isEnable(JavaPlugin plugin) {
return plugin.getServer().getPluginManager().getPlugin(getPluginName()) != null;
}
ItemStack getItemStack(String resultPart);
}