moved code to new structure
This commit is contained in:
41
src/main/java/de/steev/bm/Manager/RecipyManager.java
Normal file
41
src/main/java/de/steev/bm/Manager/RecipyManager.java
Normal file
@ -0,0 +1,41 @@
|
||||
package de.steev.bm.Manager;
|
||||
|
||||
import de.steev.bm.BetterMinecraft;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.ShapedRecipe;
|
||||
|
||||
public class RecipyManager{
|
||||
|
||||
private GameManager gameManager;
|
||||
|
||||
public RecipyManager(GameManager gameManager) {
|
||||
this.gameManager = gameManager;
|
||||
}
|
||||
|
||||
public void RegisterNew(char[] ing, Material[] mat, String[] rec, int amount, Material result, String Item){
|
||||
|
||||
BetterMinecraft plugin;
|
||||
NamespacedKey item;
|
||||
ShapedRecipe rec_item;
|
||||
|
||||
item = new NamespacedKey(this.gameManager.getPlugin(), Item);
|
||||
ItemStack itemStack = new ItemStack(result);
|
||||
itemStack.setAmount(amount);
|
||||
|
||||
rec_item = new ShapedRecipe(item, itemStack);
|
||||
|
||||
//Recipe shapes
|
||||
rec_item.shape(rec[0], rec[1], rec[2]);
|
||||
|
||||
for(int i = 0; i < ing.length; i++) {
|
||||
// Material Definitions
|
||||
rec_item.setIngredient(ing[i], mat[i]);
|
||||
}
|
||||
|
||||
// Add recipes to Server
|
||||
Bukkit.addRecipe(rec_item);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user