Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions bedrock/src/main/java/fr/moussax/bedrock/sound/SoundCue.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,35 @@
*/
public record SoundCue(Sound sound, float volume, float pitch, long delay) {

/**
* Creates an immediate sound cue without delay.
*
* @param sound Bukkit sound type
* @param volume sound volume
* @param pitch sound pitch
* @return sound cue
*/
@NonNull
public static SoundCue of(@NonNull Sound sound, float volume, float pitch) {
Objects.requireNonNull(sound, "sound cannot be null");
return new SoundCue(sound, volume, pitch, 0L);
}

/**
* Creates a sound cue with a configured delay in ticks.
*
* @param sound Bukkit sound type
* @param volume sound volume
* @param pitch sound pitch
* @param delay delay in ticks
* @return sound cue
*/
@NonNull
public static SoundCue of(@NonNull Sound sound, float volume, float pitch, long delay) {
Objects.requireNonNull(sound, "sound cannot be null");
return new SoundCue(sound, volume, pitch, delay);
}

/**
* Plays this sound at the specified location after the configured delay.
*
Expand Down
Loading
Loading