@@ -91,17 +91,8 @@ public void onEnable() {
91
91
ChatColor .WHITE + WordUtils .capitalize (dye .toString ().replaceAll ("_" , " " )) + " Bundle" );
92
92
item .setItemMeta (meta );
93
93
94
- NamespacedKey key = new NamespacedKey (this , dye + "_bundle" );
95
- ShapelessRecipe recipe = new ShapelessRecipe (key , item );
96
- recipe .addIngredient (Material .BUNDLE );
97
- recipe .addIngredient (dye .getDye ());
98
-
99
- Bukkit .addRecipe (recipe );
100
-
94
+ loadRecipe (dye , item );
101
95
recipeKeys .add (dye + "_bundle" );
102
-
103
- getServer ().getConsoleSender ()
104
- .sendMessage (ChatColor .GREEN + "[ColorBundles] Loaded recipes: " + dye + "_bundle" );
105
96
}
106
97
}
107
98
}
@@ -111,20 +102,22 @@ public void onItemsLoadEvent(ItemsAdderFirstLoadEvent evt) {
111
102
for (Dyes dye : Dyes .values ()) {
112
103
ItemStack item = CustomStack .getInstance ("colorbundles:" + dye + "_bundle" ).getItemStack ();
113
104
114
- NamespacedKey key = new NamespacedKey (this , dye + "_bundle" );
115
- ShapelessRecipe recipe = new ShapelessRecipe (key , item );
116
- recipe .addIngredient (Material .BUNDLE );
117
- recipe .addIngredient (dye .getDye ());
118
-
119
- Bukkit .addRecipe (recipe );
120
-
105
+ loadRecipe (dye , item );
121
106
recipeKeys .add (dye + "_bundle" );
122
-
123
- getServer ().getConsoleSender ()
124
- .sendMessage (ChatColor .GREEN + "[ColorBundles] Loaded recipes: " + dye + "_bundle" );
125
107
}
126
108
}
127
109
110
+ private void loadRecipe (Dyes dye , ItemStack result ) {
111
+ NamespacedKey key = new NamespacedKey (this , dye + "_bundle" );
112
+ ShapelessRecipe recipe = new ShapelessRecipe (key , result );
113
+ recipe .addIngredient (Material .BUNDLE );
114
+ recipe .addIngredient (dye .getDye ());
115
+
116
+ Bukkit .addRecipe (recipe );
117
+ getServer ().getConsoleSender ()
118
+ .sendMessage (ChatColor .GREEN + "[ColorBundles] Loaded recipes: " + dye + "_bundle" );
119
+ }
120
+
128
121
public List <String > getRecipeKeys () {
129
122
return this .recipeKeys ;
130
123
}
0 commit comments