Class PlayableSound


  • public class PlayableSound
    extends xyz.srnyx.javautilities.parents.Stringable
    Represents a Sound with a volume and pitch
    • Field Summary

      Fields 
      Modifier and Type Field Description
      @Nullable java.lang.Object category
      The SoundCategory to play the Sound in
      float pitch
      The pitch to play the Sound at
      @NotNull org.bukkit.Sound sound
      The Sound to play
      float volume
      The volume to play the Sound at
    • Constructor Summary

      Constructors 
      Constructor Description
      PlayableSound​(@NotNull org.bukkit.Sound sound)
      Creates a new PlayableSound object with a volume and pitch of 1
      PlayableSound​(@NotNull org.bukkit.Sound sound, float volume, float pitch)
      Creates a new PlayableSound object
      PlayableSound​(@NotNull org.bukkit.Sound sound, @Nullable java.lang.Object category)
      1.11+ Creates a new PlayableSound object with a volume and pitch of 1
      PlayableSound​(@NotNull org.bukkit.Sound sound, @Nullable java.lang.Object category, float volume, float pitch)
      1.11+ Creates a new PlayableSound object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void play​(@NotNull org.bukkit.entity.Player player)
      Plays the Sound to the given Player at the player's location
      void play​(@NotNull org.bukkit.entity.Player player, @Nullable org.bukkit.Location location)
      Plays the Sound to the given Player at the given Location
      void play​(@Nullable org.bukkit.World world)
      Plays the Sound in the given World at the world's spawn
      void play​(@Nullable org.bukkit.World world, @Nullable org.bukkit.Location location)
      Plays the Sound at the given Location in the given World
      • Methods inherited from class xyz.srnyx.javautilities.parents.Stringable

        toString, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • sound

        @NotNull
        public final @NotNull org.bukkit.Sound sound
        The Sound to play
      • category

        @Nullable
        public final @Nullable java.lang.Object category
        The SoundCategory to play the Sound in
      • volume

        public final float volume
        The volume to play the Sound at
      • pitch

        public final float pitch
        The pitch to play the Sound at
    • Constructor Detail

      • PlayableSound

        public PlayableSound​(@NotNull
                             @NotNull org.bukkit.Sound sound,
                             @Nullable
                             @Nullable java.lang.Object category,
                             float volume,
                             float pitch)
        1.11+ Creates a new PlayableSound object
        Parameters:
        sound - sound
        category - category
        volume - volume
        pitch - pitch
        See Also:
        1.10.2 and below
      • PlayableSound

        public PlayableSound​(@NotNull
                             @NotNull org.bukkit.Sound sound,
                             @Nullable
                             @Nullable java.lang.Object category)
        1.11+ Creates a new PlayableSound object with a volume and pitch of 1
        Parameters:
        sound - sound
        category - category
        See Also:
        1.10.2 and below
      • PlayableSound

        public PlayableSound​(@NotNull
                             @NotNull org.bukkit.Sound sound,
                             float volume,
                             float pitch)
        Creates a new PlayableSound object
        Parameters:
        sound - sound
        volume - volume
        pitch - pitch
      • PlayableSound

        public PlayableSound​(@NotNull
                             @NotNull org.bukkit.Sound sound)
        Creates a new PlayableSound object with a volume and pitch of 1
        Parameters:
        sound - sound
    • Method Detail

      • play

        public void play​(@Nullable
                         @Nullable org.bukkit.World world,
                         @Nullable
                         @Nullable org.bukkit.Location location)
        Plays the Sound at the given Location in the given World
        Parameters:
        world - the World to play the Sound in, or null to play in the default world
        location - the Location to play the Sound at, or null to play at the world's spawn
      • play

        public void play​(@Nullable
                         @Nullable org.bukkit.World world)
        Plays the Sound in the given World at the world's spawn
        Parameters:
        world - the World to play the Sound in
      • play

        public void play​(@NotNull
                         @NotNull org.bukkit.entity.Player player,
                         @Nullable
                         @Nullable org.bukkit.Location location)
        Plays the Sound to the given Player at the given Location
        Parameters:
        player - the Player to play the Sound to
        location - the Location to play the Sound at, or null to play at the player's location
      • play

        public void play​(@NotNull
                         @NotNull org.bukkit.entity.Player player)
        Plays the Sound to the given Player at the player's location
        Parameters:
        player - the Player to play the Sound to