Added config blacklist for auto crafting.

This commit is contained in:
Brianna 2020-01-17 15:18:24 -05:00
parent 5d98dea24b
commit 26d9dbcbd3
2 changed files with 8 additions and 1 deletions

View File

@ -132,8 +132,11 @@ public class ModuleAutoCrafting extends Module {
cachedCrafting.remove(hopper);
}
Recipes getRecipes(ItemStack toCraft) {
private Recipes getRecipes(ItemStack toCraft) {
Recipes recipes = cachedRecipes.get(toCraft);
if (Settings.AUTOCRAFT_BLACKLIST.getStringList().stream()
.anyMatch(r -> r.equalsIgnoreCase(toCraft.getType().name())))
return new Recipes();
if (recipes == null) {
try {
recipes = new Recipes(Bukkit.getServer().getRecipesFor(toCraft));
@ -145,6 +148,7 @@ public class ModuleAutoCrafting extends Module {
while (recipeIterator.hasNext()) {
try {
Recipe recipe = recipeIterator.next();
ItemStack stack = recipe.getResult();
if (Methods.isSimilarMaterial(stack, toCraft))
recipes.addRecipe(recipe);

View File

@ -63,6 +63,9 @@ public class Settings {
"Normally, crafting hoppers won't grab items that would fill that slot.",
"This option ejects items if that last slot is forcibly filled");
public static final ConfigSetting AUTOCRAFT_BLACKLIST = new ConfigSetting(config, "Main.AutoCraft Blacklist", Arrays.asList("BEDROCK", "EGG"),
"Anything listed here will not be able to be auto crafted.");
public static final ConfigSetting AUTOSELL_PRICES = new ConfigSetting(config, "Main.AutoSell Prices",
Arrays.asList("STONE,0.50", "COBBLESTONE,0.20", "IRON_ORE,0.35", "COAL_ORE,0.20"),
"These are the prices used by the auto sell module.");