|
6 | 6 | import dev.klash.caramel.plugin.ImplCaramelDefault;
|
7 | 7 | import dev.klash.caramel.recipe.CaramelRecipe;
|
8 | 8 | import dev.klash.caramel.recipe.CaramelRecipeList;
|
| 9 | +import org.bukkit.Bukkit; |
9 | 10 | import org.bukkit.NamespacedKey;
|
10 | 11 | import org.bukkit.command.Command;
|
11 | 12 | import org.bukkit.command.CommandSender;
|
|
19 | 20 |
|
20 | 21 | public final class Caramel extends JavaPlugin {
|
21 | 22 |
|
| 23 | + private static Caramel instance; |
22 | 24 | public static Caramel getInstance() {
|
23 |
| - return getPlugin(Caramel.class); |
| 25 | + return instance == null ? (Caramel)Bukkit.getPluginManager().getPlugin("Caramel") : instance; |
24 | 26 | }
|
25 | 27 | public CaramelCommandList commands;
|
26 | 28 | public CaramelItemList items;
|
27 | 29 | public CaramelCurrencyList currencies;
|
28 | 30 | public SpiGUI spigui;
|
29 | 31 | public CaramelGuiList guis;
|
30 | 32 |
|
31 |
| - public static NamespacedKey isCaramelKey = new NamespacedKey(Caramel.getInstance(), "is-caramel"); |
32 |
| - public static NamespacedKey caramelIDKey = new NamespacedKey(Caramel.getInstance(), "caramel-id"); |
| 33 | + public NamespacedKey caramelIDKey, isCaramelKey; |
33 | 34 |
|
34 | 35 | public String getPrefix() {
|
35 | 36 | return getConfig().getString("messages.caramel-prefix");
|
36 | 37 | }
|
37 | 38 |
|
38 | 39 | @Override
|
39 | 40 | public void onEnable() {
|
| 41 | + instance = this; |
40 | 42 | saveDefaultConfig();
|
41 | 43 | spigui = new SpiGUI(this);
|
| 44 | + caramelIDKey = new NamespacedKey(this, "caramel-id"); |
| 45 | + isCaramelKey = new NamespacedKey(this, "is-caramel"); |
42 | 46 |
|
43 | 47 | commands = new CaramelCommandList();
|
44 | 48 | items = new CaramelItemList();
|
|
0 commit comments