Interface IAudioPlayer

All Known Implementing Classes:
AudioPlayerSpigot

public interface IAudioPlayer
Represents an object that can play sounds.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    The radius in blocks around the sound source where players can hear the sound.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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.
    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.
    default void
    playSound(ILocation loc, String sound, float volume, float pitch)
    Play a sound for all players in a range of 15 blocks around the provided location.
    default void
    playSound(IVector3D pos, IWorld world, String sound, float volume, float pitch)
    Play a sound for all players in a range of 15 blocks around the provided location.
  • Field Details

    • AUDIO_RANGE

      static final double AUDIO_RANGE
      The radius in blocks around the sound source where players can hear the sound.
      See Also:
  • Method Details

    • playSound

      default void playSound(ILocation loc, String sound, float volume, float pitch)
      Play a sound for all players in a range of 15 blocks around the provided location.
      Parameters:
      loc - The location of the sound.
      sound - The sound to play.
      volume - The volume
      pitch - The pitch
    • playSound

      default void playSound(IVector3D pos, 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:
      pos - The position of the sound.
      world - The world of the position.
      sound - The sound to play.
      volume - The volume
      pitch - 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 volume
      pitch - 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 volume
      pitch - The pitch
      range - 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 @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 volume
      pitch - The pitch
      range - 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.