File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed
paper-api/src/main/java/org/bukkit
paper-server/src/main/java/org/bukkit/craftbukkit Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 22
33import io .papermc .paper .registry .RegistryAccess ;
44import io .papermc .paper .registry .RegistryKey ;
5+ import net .kyori .adventure .text .Component ;
56import org .jspecify .annotations .NullMarked ;
67
78/**
@@ -65,4 +66,32 @@ private static JukeboxSong get(String key) {
6566 @ Override
6667 @ Deprecated (forRemoval = true )
6768 String getTranslationKey ();
69+
70+ /**
71+ * Gets the sound for this song.
72+ *
73+ * @return the sound
74+ */
75+ Sound getSound ();
76+
77+ /**
78+ * Gets the description for this song.
79+ *
80+ * @return the description
81+ */
82+ Component getDescription ();
83+
84+ /**
85+ * Gets the length in seconds for this song.
86+ *
87+ * @return the length in seconds
88+ */
89+ float getLengthInSeconds ();
90+
91+ /**
92+ * Gets the comparator output for this song.
93+ *
94+ * @return the comparator output
95+ */
96+ int getComparatorOutput ();
6897}
Original file line number Diff line number Diff line change 11package org .bukkit .craftbukkit ;
22
3+ import io .papermc .paper .adventure .PaperAdventure ;
34import io .papermc .paper .registry .HolderableBase ;
5+ import net .kyori .adventure .text .Component ;
46import net .minecraft .core .Holder ;
57import net .minecraft .core .registries .Registries ;
68import net .minecraft .network .chat .contents .TranslatableContents ;
79import org .bukkit .JukeboxSong ;
10+ import org .bukkit .Sound ;
11+ import org .jspecify .annotations .NullMarked ;
812
13+ @ NullMarked
914public class CraftJukeboxSong extends HolderableBase <net .minecraft .world .item .JukeboxSong > implements JukeboxSong {
1015
1116 public static JukeboxSong minecraftToBukkit (net .minecraft .world .item .JukeboxSong minecraft ) {
@@ -33,4 +38,24 @@ public String getTranslationKey() {
3338 if (!(this .getHandle ().description ().getContents () instanceof TranslatableContents )) throw new UnsupportedOperationException ("Description isn't translatable!" ); // Paper
3439 return ((TranslatableContents ) this .getHandle ().description ().getContents ()).getKey ();
3540 }
41+
42+ @ Override
43+ public Sound getSound () {
44+ return CraftSound .minecraftHolderToBukkit (this .getHandle ().soundEvent ());
45+ }
46+
47+ @ Override
48+ public Component getDescription () {
49+ return PaperAdventure .asAdventure (this .getHandle ().description ());
50+ }
51+
52+ @ Override
53+ public float getLengthInSeconds () {
54+ return this .getHandle ().lengthInSeconds ();
55+ }
56+
57+ @ Override
58+ public int getComparatorOutput () {
59+ return this .getHandle ().comparatorOutput ();
60+ }
3661}
You can’t perform that action at this time.
0 commit comments