diff --git a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java index 5e385a3788..4c56408858 100644 --- a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java +++ b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java @@ -248,20 +248,6 @@ public final class CraftLegacy { return name(material); } - public static Material[] modern_values() { - Material[] values = Material.values(); - return Arrays.copyOfRange(values, 0, Material.LEGACY_AIR.ordinal()); - } - - public static int modern_ordinal(Material material) { - if (material.isLegacy()) { - // SPIGOT-4002: Fix for eclipse compiler manually compiling in default statements to lookupswitch - throw new NoSuchFieldError("Legacy field ordinal: " + material); - } - - return material.ordinal(); - } - public static void init() { // } diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java index 6578e34715..e3b49b7266 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java +++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java @@ -243,10 +243,10 @@ public class Commodore switch ( name ) { case "values": - super.visitMethodInsn( opcode, "org/bukkit/craftbukkit/legacy/CraftLegacy", "modern_" + name, desc, itf ); + super.visitMethodInsn( opcode, "org/bukkit/craftbukkit/util/CraftLegacy", "modern_" + name, desc, itf ); return; case "ordinal": - super.visitMethodInsn( Opcodes.INVOKESTATIC, "org/bukkit/craftbukkit/legacy/CraftLegacy", "modern_" + name, "(Lorg/bukkit/Material;)I", false ); + super.visitMethodInsn( Opcodes.INVOKESTATIC, "org/bukkit/craftbukkit/util/CraftLegacy", "modern_" + name, "(Lorg/bukkit/Material;)I", false ); return; } } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftLegacy.java b/src/main/java/org/bukkit/craftbukkit/util/CraftLegacy.java index 7d2ab460c7..c8dde75de2 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftLegacy.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftLegacy.java @@ -1,5 +1,6 @@ package org.bukkit.craftbukkit.util; +import java.util.Arrays; import org.bukkit.Material; import org.bukkit.material.MaterialData; @@ -24,4 +25,18 @@ public final class CraftLegacy { public static Material fromLegacy(MaterialData materialData) { return org.bukkit.craftbukkit.legacy.CraftLegacy.fromLegacy(materialData); } + + public static Material[] modern_values() { + Material[] values = Material.values(); + return Arrays.copyOfRange(values, 0, Material.LEGACY_AIR.ordinal()); + } + + public static int modern_ordinal(Material material) { + if (material.isLegacy()) { + // SPIGOT-4002: Fix for eclipse compiler manually compiling in default statements to lookupswitch + throw new NoSuchFieldError("Legacy field ordinal: " + material); + } + + return material.ordinal(); + } } diff --git a/src/test/java/org/bukkit/craftbukkit/legacy/LegacyTest.java b/src/test/java/org/bukkit/craftbukkit/legacy/LegacyTest.java index a246f6d31d..ccdfe30653 100644 --- a/src/test/java/org/bukkit/craftbukkit/legacy/LegacyTest.java +++ b/src/test/java/org/bukkit/craftbukkit/legacy/LegacyTest.java @@ -99,7 +99,7 @@ public class LegacyTest extends AbstractTestingBase { Assert.assertTrue("Must iterate only legacy materials", material.isLegacy()); } - for (Material material : CraftLegacy.modern_values()) { + for (Material material : org.bukkit.craftbukkit.util.CraftLegacy.modern_values()) { Assert.assertFalse("Must iterate only modern materials", material.isLegacy()); } }