Skip to content

Commit b07e1bc

Browse files
committed
Cleanup and docs
1 parent 5aae49e commit b07e1bc

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

paper-api/src/main/java/org/bukkit/MusicInstrument.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
import io.papermc.paper.registry.RegistryKey;
66
import java.util.Collection;
77
import java.util.Collections;
8+
import java.util.NoSuchElementException;
9+
import net.kyori.adventure.key.Key;
810
import net.kyori.adventure.text.Component;
11+
import org.jetbrains.annotations.ApiStatus;
912
import org.jspecify.annotations.NullMarked;
1013
import org.jspecify.annotations.Nullable;
1114

@@ -35,7 +38,7 @@ public abstract class MusicInstrument implements Keyed, net.kyori.adventure.tran
3538
* Returns a {@link MusicInstrument} by a {@link NamespacedKey}.
3639
*
3740
* @param namespacedKey the key
38-
* @return the event or null
41+
* @return the music instrument or null
3942
* @deprecated Use {@link Registry#get(NamespacedKey)} instead.
4043
*/
4144
@Nullable
@@ -55,6 +58,14 @@ public static Collection<MusicInstrument> values() {
5558
return Collections.unmodifiableCollection(Lists.newArrayList(Registry.INSTRUMENT));
5659
}
5760

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
5869
private static MusicInstrument getInstrument(final String key) {
5970
return RegistryAccess.registryAccess().getRegistry(RegistryKey.INSTRUMENT).getOrThrow(NamespacedKey.minecraft(key));
6071
}
@@ -101,7 +112,7 @@ private static MusicInstrument getInstrument(final String key) {
101112
*/
102113
@Deprecated(forRemoval = true, since = "1.20.5")
103114
@Override
104-
public net.kyori.adventure.key.@org.jetbrains.annotations.NotNull Key key() {
115+
public Key key() {
105116
return Keyed.super.key();
106117
}
107118

0 commit comments

Comments
 (0)