diff --git a/api/src/main/java/net/kyori/adventure/sound/Sound.java b/api/src/main/java/net/kyori/adventure/sound/Sound.java index 8c0476a87..225c51864 100644 --- a/api/src/main/java/net/kyori/adventure/sound/Sound.java +++ b/api/src/main/java/net/kyori/adventure/sound/Sound.java @@ -112,6 +112,48 @@ public interface Sound extends Examinable { }; } + /** + * Creates a new sound. + * + * @param name the name + * @param source the source + * @param volume the volume + * @param pitch the pitch + * @return the sound + * @since 4.8.0 + */ + static @NonNull Sound sound(final @NonNull Key name, final Source.@NonNull Provider source, final float volume, final float pitch) { + return sound(name, source.soundSource(), volume, pitch); + } + + /** + * Creates a new sound. + * + * @param type the type + * @param source the source + * @param volume the volume + * @param pitch the pitch + * @return the sound + * @since 4.8.0 + */ + static @NonNull Sound sound(final @NonNull Type type, final Source.@NonNull Provider source, final float volume, final float pitch) { + return sound(type, source.soundSource(), volume, pitch); + } + + /** + * Creates a new sound. + * + * @param type the type + * @param source the source + * @param volume the volume + * @param pitch the pitch + * @return the sound + * @since 4.8.0 + */ + static @NonNull Sound sound(final @NonNull Supplier type, final Source.@NonNull Provider source, final float volume, final float pitch) { + return sound(type, source.soundSource(), volume, pitch); + } + /** * Gets the name. * @@ -172,6 +214,21 @@ enum Source { Source(final String name) { this.name = name; } + + /** + * A provider of sound sources. + * + * @since 4.8.0 + */ + public interface Provider { + /** + * Gets the source. + * + * @return the source + * @since 4.8.0 + */ + @NonNull Source soundSource(); + } } /**