1
1
package com .paratopiamc .colorbundles ;
2
2
3
+ import java .util .ArrayList ;
4
+ import java .util .List ;
3
5
import org .bukkit .Bukkit ;
4
6
import org .bukkit .Material ;
5
7
import org .bukkit .NamespacedKey ;
6
8
import org .bukkit .inventory .ItemStack ;
7
- import org .bukkit .inventory .ShapedRecipe ;
9
+ import org .bukkit .inventory .ShapelessRecipe ;
8
10
import org .bukkit .inventory .meta .ItemMeta ;
9
11
import org .bukkit .plugin .java .JavaPlugin ;
10
12
import net .md_5 .bungee .api .ChatColor ;
11
13
12
14
public final class ColorBundles extends JavaPlugin {
15
+ private List <String > recipeKeys ;
16
+
13
17
private static enum Dyes {
14
18
BLACK ("black" ), BLUE ("blue" ), BROWN ("brown" ), CYAN ("cyan" ), GRAY ("gray" ), GREEN ("green" ),
15
19
LIGHT_BLUE ("light_blue" ), LIGHT_GRAY ("light_gray" ), LIME ("lime" ), MAGENTA ("magenta" ), ORANGE ("orange" ),
@@ -43,7 +47,9 @@ public void onEnable() {
43
47
}
44
48
}
45
49
saveDefaultConfig ();
50
+ getServer ().getPluginManager ().registerEvents (new CraftingListener (this ), this );
46
51
52
+ recipeKeys = new ArrayList <>();
47
53
for (Dyes dye : Dyes .values ()) {
48
54
ItemStack item = new ItemStack (Material .BUNDLE );
49
55
ItemMeta meta = item .getItemMeta ();
@@ -53,16 +59,20 @@ public void onEnable() {
53
59
54
60
item .setItemMeta (meta );
55
61
NamespacedKey key = new NamespacedKey (this , dye + "_bundle" );
56
- ShapedRecipe recipe = new ShapedRecipe (key , item );
62
+ ShapelessRecipe recipe = new ShapelessRecipe (key , item );
57
63
58
- recipe .shape ("BD" );
59
- recipe .setIngredient ('B' , Material .BUNDLE );
60
- recipe .setIngredient ('D' , dye .getDye ());
64
+ recipe .addIngredient (Material .BUNDLE );
65
+ recipe .addIngredient (dye .getDye ());
61
66
62
67
Bukkit .addRecipe (recipe );
68
+ recipeKeys .add (dye + "_bundle" );
63
69
64
70
getServer ().getConsoleSender ()
65
71
.sendMessage (ChatColor .GREEN + "[ColorBundles] Loaded recipes: " + dye + "_bundle" );
66
72
}
67
73
}
74
+
75
+ public List <String > getRecipeKeys () {
76
+ return this .recipeKeys ;
77
+ }
68
78
}
0 commit comments