#706: Add playSound with Entity as source

By: Gero <gecam59@gmail.com>
This commit is contained in:
Bukkit/Spigot 2022-01-11 18:53:34 +11:00
parent 9003a55038
commit 5dd0f2a5b6
2 changed files with 51 additions and 1 deletions

View file

@ -2014,7 +2014,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
void setAmbientSpawnLimit(int limit);
/**
* Play a Sound at the provided Location in the World
* Play a Sound at the provided Location in the World.
* <p>
* This function will fail silently if Location or Sound are null.
*
@ -2067,6 +2067,31 @@ 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 location of the provided entity in the World.
* <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 volume The volume of the sound
* @param pitch The pitch of the sound
*/
void playSound(@NotNull Entity entity, @NotNull Sound sound, float volume, float pitch);
/**
* Play a Sound at the location of the provided entity in the World.
* <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
*/
void playSound(@NotNull Entity entity, @NotNull Sound sound, @NotNull SoundCategory category, float volume, float pitch);
/**
* Get an array containing the names of all the {@link GameRule}s.
*

View file

@ -349,6 +349,31 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public void playSound(@NotNull Location location, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch);
/**
* Play a sound for a player at the location of the entity.
* <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 volume The volume of the sound
* @param pitch The pitch of the sound
*/
public void playSound(@NotNull Entity entity, @NotNull Sound sound, float volume, float pitch);
/**
* Play a sound for a player at the location of the entity.
* <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
*/
public void playSound(@NotNull Entity entity, @NotNull Sound sound, @NotNull SoundCategory category, float volume, float pitch);
/**
* Stop the specified sound from playing.
*