-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHook.java
More file actions
58 lines (49 loc) · 1.38 KB
/
Hook.java
File metadata and controls
58 lines (49 loc) · 1.38 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
54
55
56
57
58
package fr.traqueur.recipes.api.hook;
import fr.traqueur.recipes.api.domains.Ingredient;
import fr.traqueur.recipes.impl.hook.Hooks;
import org.bukkit.Bukkit;
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
* @return If the plugin is enabled
*/
default boolean isEnable() {
return Bukkit.getPluginManager().getPlugin(getPluginName()) != null;
}
/**
* Get the ItemStack from a result part
* @param resultPart The result part to get the ItemStack from
* @return The ItemStack from the result part
*/
ItemStack getItemStack(String resultPart);
}