Phase out NamespacedKey and org.bukkit.Keyed while maintaining runtime compat #10568
Machine-Maker
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Regsitry
As I see it there are several steps to this process, the first of which is making
org.bukkit.Registry's genericTextendnet.kyori.adventure.key.Keyedinstead oforg.bukkit.Keyed. That is done in #9009.The next step can be done with registries with types that are backed by a server impl type, like
Registry.STRUCTURE_TYPE. I think this can be handled by making the API type (in this example the abstract classStructureType) extend adventureKeyedinstead of bukkitKeyed.That leaves 2 issues:
KeyedStructureType#getKey()The first can be handled by making the impl type still extend the obsolete bukkit
Keyed. That will allow casts to still succeed. It also will allow fields typed bukkit Keyed to work stillThe second can be handled by rewriting
StructureType#getKey()to first cast toCraftStructureTypeand then call getKey on that.Other uses
most of the other uses can just have bytecode rewriting to change the parameter type to adventure
Key. In places whereNamespacedKeyis the return type, the bytecode rewriting can just insert another static invoke to convert the returnedKeyto aNamespacedKeyif that's what the plugin expects.All reactions