Adds negation for material names and presets #13
This commit is contained in:
@ -1,8 +1,13 @@
|
||||
package net.knarcraft.blacksmith.util;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.EnchantmentTarget;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public final class ItemHelper {
|
||||
|
||||
private ItemHelper() {
|
||||
@ -40,4 +45,20 @@ public final class ItemHelper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a complete list of all reforge-able materials
|
||||
*
|
||||
* @return <p>A complete list of reforge-able materials</p>
|
||||
*/
|
||||
public static List<Material> getAllReforgeAbleMaterials() {
|
||||
List<Material> reforgeAbleMaterials = new ArrayList<>();
|
||||
for (Material material : Material.values()) {
|
||||
ItemStack item = new ItemStack(material);
|
||||
if (item.getItemMeta() instanceof Damageable && EnchantmentTarget.BREAKABLE.includes(item)) {
|
||||
reforgeAbleMaterials.add(material);
|
||||
}
|
||||
}
|
||||
return reforgeAbleMaterials;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user