Skip to content

Commit

Permalink
SPIGOT-5532: Material.values() yields an exception
Browse files Browse the repository at this point in the history
  • Loading branch information
md-5 committed Jan 22, 2020
1 parent efd6cf5 commit a81f6ed
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/org/bukkit/craftbukkit/util/Commodore.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,10 @@ public void visitMethodInsn(int opcode, String owner, String name, String desc,
switch ( name )
{
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;
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;
}
}
Expand Down Expand Up @@ -300,22 +300,22 @@ public void visitMethodInsn(int opcode, String owner, String name, String desc,
case "valueOf":
case "getMaterial":
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;
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;
case "name":
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;
}
}

if ( retType.getSort() == Type.OBJECT && retType.getInternalName().equals( "org/bukkit/Material" ) && owner.startsWith( "org/bukkit" ) )
{
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;
}

Expand Down

0 comments on commit a81f6ed

Please sign in to comment.