5
5
import io .papermc .paper .registry .RegistryKey ;
6
6
import java .util .Collection ;
7
7
import java .util .Collections ;
8
+ import java .util .NoSuchElementException ;
9
+ import net .kyori .adventure .key .Key ;
8
10
import net .kyori .adventure .text .Component ;
11
+ import org .jetbrains .annotations .ApiStatus ;
9
12
import org .jspecify .annotations .NullMarked ;
10
13
import org .jspecify .annotations .Nullable ;
11
14
@@ -35,7 +38,7 @@ public abstract class MusicInstrument implements Keyed, net.kyori.adventure.tran
35
38
* Returns a {@link MusicInstrument} by a {@link NamespacedKey}.
36
39
*
37
40
* @param namespacedKey the key
38
- * @return the event or null
41
+ * @return the music instrument or null
39
42
* @deprecated Use {@link Registry#get(NamespacedKey)} instead.
40
43
*/
41
44
@ Nullable
@@ -55,6 +58,14 @@ public static Collection<MusicInstrument> values() {
55
58
return Collections .unmodifiableCollection (Lists .newArrayList (Registry .INSTRUMENT ));
56
59
}
57
60
61
+ /**
62
+ * Returns a {@link MusicInstrument} by a {@link String} key.
63
+ *
64
+ * @param key the key
65
+ * @return the music instrument
66
+ * @throws NoSuchElementException if there is no object with the given key
67
+ */
68
+ @ ApiStatus .Internal
58
69
private static MusicInstrument getInstrument (final String key ) {
59
70
return RegistryAccess .registryAccess ().getRegistry (RegistryKey .INSTRUMENT ).getOrThrow (NamespacedKey .minecraft (key ));
60
71
}
@@ -101,7 +112,7 @@ private static MusicInstrument getInstrument(final String key) {
101
112
*/
102
113
@ Deprecated (forRemoval = true , since = "1.20.5" )
103
114
@ Override
104
- public net . kyori . adventure . key . @ org . jetbrains . annotations . NotNull Key key () {
115
+ public Key key () {
105
116
return Keyed .super .key ();
106
117
}
107
118
0 commit comments