From 2b398367148cc68a3b1247945177a0f302b69e00 Mon Sep 17 00:00:00 2001 From: jascotty2 Date: Sat, 7 Sep 2019 15:06:47 -0500 Subject: [PATCH] prevent false material lookups when using compatibility --- .../core/compatibility/LegacyMaterials.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/songoda/core/compatibility/LegacyMaterials.java b/src/main/java/com/songoda/core/compatibility/LegacyMaterials.java index d16489ff..39940d1e 100644 --- a/src/main/java/com/songoda/core/compatibility/LegacyMaterials.java +++ b/src/main/java/com/songoda/core/compatibility/LegacyMaterials.java @@ -1022,15 +1022,17 @@ public enum LegacyMaterials { private static final Map lookupMap = new HashMap(); static { - for (LegacyMaterials m : values()) { - lookupMap.put(m.name(), m); - lookupMap.put(m.material + ":" + (m.data == null ? "" : m.data), m); - } - for (LegacyMaterials m : values()) { - if (!lookupMap.containsKey(m.legacy)) { - lookupMap.put(m.legacy, m); - } - } + for (LegacyMaterials m : values()) { + lookupMap.put(m.name(), m); + if (!m.usesCompatibility()) { + lookupMap.put(m.material + ":" + (m.data == null ? "" : m.data), m); + } + } + for (LegacyMaterials m : values()) { + if (!m.usesCompatibility() && !lookupMap.containsKey(m.legacy)) { + lookupMap.put(m.legacy, m); + } + } } LegacyMaterials() {