#1393: Improve field rename handling and centralize conversion between bukkit and string more

By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
CraftBukkit/Spigot
2024-05-04 08:19:07 +10:00
parent f91094ddfd
commit acdb83379e
17 changed files with 313 additions and 90 deletions

View File

@@ -38,6 +38,18 @@ public class CraftMusicInstrument extends MusicInstrument implements Handleable<
+ ", this can happen if a plugin creates its own instrument without properly registering it.");
}
public static String bukkitToString(MusicInstrument bukkit) {
Preconditions.checkArgument(bukkit != null);
return bukkit.getKey().toString();
}
public static MusicInstrument stringToBukkit(String string) {
Preconditions.checkArgument(string != null);
return Registry.INSTRUMENT.get(NamespacedKey.fromString(string));
}
private final NamespacedKey key;
private final Instrument handle;