3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 04:20:08 +01:00

SPIGOT-4002: Fix usage of default: statements in 1.13 plugins compiled w/ Eclipse

Dieser Commit ist enthalten in:
md_5 2018-07-15 15:00:35 +10:00
Ursprung 421c1728c8
Commit 72cf620d47
2 geänderte Dateien mit 12 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -196,6 +196,9 @@ public class Commodore
case "values": case "values":
super.visitMethodInsn( opcode, "org/bukkit/craftbukkit/util/CraftLegacy", "modern_" + name, desc, itf ); super.visitMethodInsn( opcode, "org/bukkit/craftbukkit/util/CraftLegacy", "modern_" + name, desc, itf );
return; return;
case "ordinal":
super.visitMethodInsn( Opcodes.INVOKESTATIC, "org/bukkit/craftbukkit/util/CraftLegacy", "modern_" + name, "(Lorg/bukkit/Material;)I", false );
return;
} }
} }

Datei anzeigen

@ -221,6 +221,15 @@ public class CraftLegacy {
return Arrays.copyOfRange(values, 0, Material.LEGACY_AIR.ordinal()); 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();
}
static { static {
SPAWN_EGGS.put(EntityType.BAT, Material.BAT_SPAWN_EGG); SPAWN_EGGS.put(EntityType.BAT, Material.BAT_SPAWN_EGG);
SPAWN_EGGS.put(EntityType.BLAZE, Material.BLAZE_SPAWN_EGG); SPAWN_EGGS.put(EntityType.BLAZE, Material.BLAZE_SPAWN_EGG);