No Material EnumSets

This commit is contained in:
Sn0wStorm 2022-07-09 21:21:53 +02:00
parent 902a0bbd2c
commit 56a1c12a6d
2 changed files with 8 additions and 6 deletions

View File

@ -20,8 +20,8 @@ public class BCauldronRecipe {
public static List<BCauldronRecipe> recipes = new ArrayList<>();
public static int numConfigRecipes;
public static List<RecipeItem> acceptedCustom = new ArrayList<>(); // All accepted custom and other items
public static Set<Material> acceptedSimple = EnumSet.noneOf(Material.class); // All accepted simple items
public static Set<Material> acceptedMaterials = EnumSet.noneOf(Material.class); // Fast cache for all accepted Materials
public static Set<Material> acceptedSimple = new HashSet<>(); // All accepted simple items
public static Set<Material> acceptedMaterials = new HashSet<>(); // Fast cache for all accepted Materials
private String name;
private List<RecipeItem> ingredients;

View File

@ -13,7 +13,7 @@ import org.bukkit.material.Wood;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Set;
import static com.dre.brewery.BCauldron.EMPTY;
@ -42,7 +42,9 @@ public class LegacyUtil {
} catch (ClassNotFoundException | NoSuchMethodException | SecurityException ignored) {
}
Set<Material> planks = EnumSet.noneOf(Material.class);
// EnumSet not supposed to be used anymore
// See https://www.spigotmc.org/threads/spigot-bungeecord-1-19.559742/
Set<Material> planks = new HashSet<>();
for (Material m : Material.values()) {
if (m.name().endsWith("PLANKS")) {
planks.add(m);
@ -50,7 +52,7 @@ public class LegacyUtil {
}
PLANKS = planks;
Set<Material> woodStairs = EnumSet.noneOf(Material.class);
Set<Material> woodStairs = new HashSet<>();
Material[] gotStairs = {
get("OAK_STAIRS", "WOOD_STAIRS"),
get("SPRUCE_STAIRS", "SPRUCE_WOOD_STAIRS"),
@ -70,7 +72,7 @@ public class LegacyUtil {
WOOD_STAIRS = woodStairs;
Set<Material> fences = EnumSet.noneOf(Material.class);
Set<Material> fences = new HashSet<>();
for (Material m : Material.values()) {
if (m.name().endsWith("FENCE")) {
fences.add(m);