Package com.marcusslover.plus.lib.sound
Class Music
java.lang.Object
com.marcusslover.plus.lib.sound.Music
Music can be used to loop notes for an audience or command sender.
Example:
Music.of(Note.of(Key.key("music.loop"), 0.2f, 1f), 2400).send(audience);
This will play the note "music.loop" for 2400 ticks (2 minutes) for the audience.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected NoteThe intro note to play before the loop.protected longThe length of the intro in ticks.protected NoteThe note to play on loop.protected longThe length of the loop in ticks.protected final Map<net.kyori.adventure.audience.Audience, Music.Session> protected NoteThe note to play when stopped. -
Method Summary
Modifier and TypeMethodDescriptionvoidforceStop(net.kyori.adventure.audience.Audience audience) Stop the music from the audience without playing the tail.void@NotNull MusicSet the intro note and length.@NotNull MusicSet the loop note and length.static @NotNull Musicof(@NotNull Note intro, long introLength, @NotNull Note loop, long loopLength, @NotNull Note tail, @NotNull net.kyori.adventure.audience.Audience audience) Create a new music object with an intro and tail note.static @NotNull MusicCreates a new music object.voidplay(net.kyori.adventure.audience.Audience audience) @NotNull Musicsend(net.kyori.adventure.audience.Audience audience) <T extends org.bukkit.command.CommandSender>
@NotNull Musicsend(T target) voidstop(Music.Session session) Stop the music for an audience and play the tail if it exists.voidstop(net.kyori.adventure.audience.Audience audience) voidstopAll()@NotNull MusicSet the tail note and length.
-
Field Details
-
sessions
-
intro
The intro note to play before the loop. -
introLength
protected long introLengthThe length of the intro in ticks. -
loop
The note to play on loop. -
loopLength
protected long loopLengthThe length of the loop in ticks. -
tail
The note to play when stopped.
-
-
Method Details
-
of
@NotNull public static @NotNull Music of(@NotNull @NotNull Note note, long noteLength, @NotNull @NotNull net.kyori.adventure.audience.Audience audience) Creates a new music object.- Parameters:
note- The note to play on loop.noteLength- The length of the note in ticks.- Returns:
- The music object.
-
of
@NotNull public static @NotNull Music of(@NotNull @NotNull Note intro, long introLength, @NotNull @NotNull Note loop, long loopLength, @NotNull @NotNull Note tail, @NotNull @NotNull net.kyori.adventure.audience.Audience audience) Create a new music object with an intro and tail note.- Parameters:
intro- Note to play before the loop.introLength- Length of the intro in ticks.loop- Note to play on loop.loopLength- Length of the loop in ticks.tail- Note to play when stopped.- Returns:
- The music object.
-
stop
Stop the music for an audience and play the tail if it exists.- Parameters:
session- The session that you would like to stop.
-
stop
public void stop(net.kyori.adventure.audience.Audience audience) -
stopAll
public void stopAll() -
forceStop
public void forceStop(net.kyori.adventure.audience.Audience audience) Stop the music from the audience without playing the tail.- Parameters:
audience- The audience.
-
forceStopAll
public void forceStopAll() -
send
-
send
-
intro
Set the intro note and length.- Parameters:
intro- Note to play before the loop.introLength- Length of the intro in ticks.- Returns:
- The music object.
-
loop
Set the loop note and length.- Parameters:
loop- Note to play on loop.loopLength- Length of the loop in ticks.- Returns:
- The music object.
-
tail
Set the tail note and length.- Parameters:
tail- Note to play when stopped.- Returns:
- The music object.
-
playAllSessions
-
play
public void play(net.kyori.adventure.audience.Audience audience)
-