split direct holder support up from ctor accepting Holder

Enchantment shouldn't support direct holders despite the ctor
accepting a Holder type. We want to limit the types
to ones that are actually used as direct holders in the game
This commit is contained in:
Jake Potrebic
2025-01-13 20:12:13 -08:00
parent 6fde26d7f8
commit fe75eaf09a
12 changed files with 70 additions and 58 deletions

View File

@@ -32,7 +32,7 @@ public class CraftMusicInstrument extends MusicInstrument implements io.papermc.
public static Object bukkitToString(MusicInstrument bukkit) { // Paper - switch to Holder
Preconditions.checkArgument(bukkit != null);
return ((CraftMusicInstrument) bukkit).toBukkitSerializationObject(Instrument.CODEC); // Paper - switch to Holder
return ((CraftMusicInstrument) bukkit).toBukkitSerializationObject(Instrument.DIRECT_CODEC); // Paper - switch to Holder
}
public static MusicInstrument stringToBukkit(Object string) { // Paper - switch to Holder