#938: Various Sound API improvements

By: Jishuna <joshl5324@gmail.com>
This commit is contained in:
Bukkit/Spigot
2023-11-17 19:54:43 +13:00
parent 44cbcb80d4
commit 1f322369a0
4 changed files with 203 additions and 35 deletions

View File

@@ -2109,6 +2109,18 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
*/
void setSpawnLimit(@NotNull SpawnCategory spawnCategory, int limit);
/**
* Play a note at the provided Location in the World. <br>
* This <i>will</i> work with cake.
* <p>
* This method will fail silently when called with {@link Instrument#CUSTOM_HEAD}.
*
* @param loc The location to play the note
* @param instrument The instrument
* @param note The note
*/
void playNote(@NotNull Location loc, @NotNull Instrument instrument, @NotNull Note note);
/**
* Play a Sound at the provided Location in the World.
* <p>
@@ -2163,6 +2175,38 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
*/
void playSound(@NotNull Location location, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch);
/**
* Play a Sound at the provided Location in the World. For sounds with multiple
* variations passing the same seed will always play the same variation.
* <p>
* This function will fail silently if Location or Sound are null.
*
* @param location The location to play the sound
* @param sound The sound to play
* @param category the category of the sound
* @param volume The volume of the sound
* @param pitch The pitch of the sound
* @param seed The seed for the sound
*/
void playSound(@NotNull Location location, @NotNull Sound sound, @NotNull SoundCategory category, float volume, float pitch, long seed);
/**
* Play a Sound at the provided Location in the World. For sounds with multiple
* variations passing the same seed will always play the same variation.
* <p>
* This function will fail silently if Location or Sound are null. No sound will
* be heard by the players if their clients do not have the respective sound for
* the value passed.
*
* @param location The location to play the sound
* @param sound The internal sound name to play
* @param category the category of the sound
* @param volume The volume of the sound
* @param pitch The pitch of the sound
* @param seed The seed for the sound
*/
void playSound(@NotNull Location location, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch, long seed);
/**
* Play a Sound at the location of the provided entity in the World.
* <p>
@@ -2213,6 +2257,38 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
*/
void playSound(@NotNull Entity entity, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch);
/**
* Play a Sound at the location of the provided entity in the World. For sounds
* with multiple variations passing the same seed will always play the same
* variation.
* <p>
* This function will fail silently if Entity or Sound are null.
*
* @param entity The entity to play the sound
* @param sound The sound to play
* @param category The category of the sound
* @param volume The volume of the sound
* @param pitch The pitch of the sound
* @param seed The seed for the sound
*/
void playSound(@NotNull Entity entity, @NotNull Sound sound, @NotNull SoundCategory category, float volume, float pitch, long seed);
/**
* Play a Sound at the location of the provided entity in the World. For sounds
* with multiple variations passing the same seed will always play the same
* variation.
* <p>
* This function will fail silently if Entity or Sound are null.
*
* @param entity The entity to play the sound
* @param sound The sound to play
* @param category The category of the sound
* @param volume The volume of the sound
* @param pitch The pitch of the sound
* @param seed The seed for the sound
*/
void playSound(@NotNull Entity entity, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch, long seed);
/**
* Get an array containing the names of all the {@link GameRule}s.
*