3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-23 14:50:08 +01:00

SPIGOT-5532: Material.values() yields an exception

Dieser Commit ist enthalten in:
md_5 2020-01-22 13:23:55 +11:00
Ursprung efd6cf55fc
Commit a81f6ed397

Datei anzeigen

@ -243,10 +243,10 @@ public class Commodore
switch ( name ) switch ( name )
{ {
case "values": case "values":
super.visitMethodInsn( opcode, "org/bukkit/craftbukkit/util/CraftLegacy", "modern_" + name, desc, itf ); super.visitMethodInsn( opcode, "org/bukkit/craftbukkit/legacy/CraftLegacy", "modern_" + name, desc, itf );
return; return;
case "ordinal": case "ordinal":
super.visitMethodInsn( Opcodes.INVOKESTATIC, "org/bukkit/craftbukkit/util/CraftLegacy", "modern_" + name, "(Lorg/bukkit/Material;)I", false ); super.visitMethodInsn( Opcodes.INVOKESTATIC, "org/bukkit/craftbukkit/legacy/CraftLegacy", "modern_" + name, "(Lorg/bukkit/Material;)I", false );
return; return;
} }
} }
@ -300,14 +300,14 @@ public class Commodore
case "valueOf": case "valueOf":
case "getMaterial": case "getMaterial":
case "matchMaterial": case "matchMaterial":
super.visitMethodInsn( opcode, "org/bukkit/craftbukkit/util/CraftLegacy", name, desc, itf ); super.visitMethodInsn( opcode, "org/bukkit/craftbukkit/legacy/CraftLegacy", name, desc, itf );
return; return;
case "ordinal": case "ordinal":
super.visitMethodInsn( Opcodes.INVOKESTATIC, "org/bukkit/craftbukkit/util/CraftLegacy", "ordinal", "(Lorg/bukkit/Material;)I", false ); super.visitMethodInsn( Opcodes.INVOKESTATIC, "org/bukkit/craftbukkit/legacy/CraftLegacy", "ordinal", "(Lorg/bukkit/Material;)I", false );
return; return;
case "name": case "name":
case "toString": case "toString":
super.visitMethodInsn( Opcodes.INVOKESTATIC, "org/bukkit/craftbukkit/util/CraftLegacy", name, "(Lorg/bukkit/Material;)Ljava/lang/String;", false ); super.visitMethodInsn( Opcodes.INVOKESTATIC, "org/bukkit/craftbukkit/legacy/CraftLegacy", name, "(Lorg/bukkit/Material;)Ljava/lang/String;", false );
return; return;
} }
} }
@ -315,7 +315,7 @@ public class Commodore
if ( retType.getSort() == Type.OBJECT && retType.getInternalName().equals( "org/bukkit/Material" ) && owner.startsWith( "org/bukkit" ) ) if ( retType.getSort() == Type.OBJECT && retType.getInternalName().equals( "org/bukkit/Material" ) && owner.startsWith( "org/bukkit" ) )
{ {
super.visitMethodInsn( opcode, owner, name, desc, itf ); super.visitMethodInsn( opcode, owner, name, desc, itf );
super.visitMethodInsn( Opcodes.INVOKESTATIC, "org/bukkit/craftbukkit/util/CraftLegacy", "toLegacy", "(Lorg/bukkit/Material;)Lorg/bukkit/Material;", false ); super.visitMethodInsn( Opcodes.INVOKESTATIC, "org/bukkit/craftbukkit/legacy/CraftLegacy", "toLegacy", "(Lorg/bukkit/Material;)Lorg/bukkit/Material;", false );
return; return;
} }