Interface IAudioPlayer
- All Known Implementing Classes:
AudioPlayerSpigot
public interface IAudioPlayer
Represents an object that can play sounds.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleThe radius in blocks around the sound source where players can hear the sound. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidPlay a sound for all players in a range of 15 blocks around the provided location.default voidplaySound(double x, double y, double z, IWorld world, String sound, float volume, float pitch, double range) Play a sound for all players in a range of 15 blocks around the provided location.voidplaySound(double x, double y, double z, IWorld world, String sound, float volume, float pitch, double range, @Nullable DoubleUnaryOperator attenuationFunction) Play a sound for all players in a range of 15 blocks around the provided location.default voidPlay a sound for all players in a range of 15 blocks around the provided location.default voidPlay a sound for all players in a range of 15 blocks around the provided location.
-
Field Details
-
AUDIO_RANGE
static final double AUDIO_RANGEThe radius in blocks around the sound source where players can hear the sound.- See Also:
-
-
Method Details
-
playSound
-
playSound
Play a sound for all players in a range of 15 blocks around the provided location.- Parameters:
pos- The position of the sound.world- The world of the position.sound- The sound to play.volume- The volumepitch- The pitch
-
playSound
default void playSound(double x, double y, double z, IWorld world, String sound, float volume, float pitch) Play a sound for all players in a range of 15 blocks around the provided location.- Parameters:
x- The x coordinate of the location.y- The y coordinate of the location.z- The z coordinate of the location.world- The world of the position.sound- The sound to play.volume- The volumepitch- The pitch
-
playSound
default void playSound(double x, double y, double z, IWorld world, String sound, float volume, float pitch, double range) Play a sound for all players in a range of 15 blocks around the provided location.- Parameters:
x- The x coordinate of the location.y- The y coordinate of the location.z- The z coordinate of the location.world- The world of the position.sound- The sound to play.volume- The volumepitch- The pitchrange- The range of the sound.
-
playSound
void playSound(double x, double y, double z, IWorld world, String sound, float volume, float pitch, double range, @Nullable DoubleUnaryOperator attenuationFunction) Play a sound for all players in a range of 15 blocks around the provided location.- Parameters:
x- The x coordinate of the location.y- The y coordinate of the location.z- The z coordinate of the location.world- The world of the position.sound- The sound to play.volume- The volumepitch- The pitchrange- The range of the sound.attenuationFunction- The function that determines how the volume of the sound changes with distance. If null, the volume will not change. The function takes the distance as input and returns the multiplier for the volume.For example, if the function returns 0.5 for a distance of 10, the volume will be multiplied by 0.5 for all players that are 10 blocks away from the sound.
-