Class Sounds

java.lang.Object
dev.demeng.pluginbase.Sounds

public final class Sounds extends Object
Various utilities for playing sound effects.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The prefix that the util will search for, used to determine if the plugin should play a vanilla sound or a custom sound (such as one in a resource pack).
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    playCustomToLocation(@NotNull org.bukkit.Location loc, @NotNull String sound, float volume, float pitch)
    Plays a custom sound to a location.
    static void
    playCustomToPlayer(@NotNull org.bukkit.entity.Player player, @NotNull String sound, float volume, float pitch)
    Plays a custom sound to a player.
    static void
    playToLocation(@NotNull org.bukkit.Location loc, @NotNull org.bukkit.configuration.ConfigurationSection section)
    Plays the sound in the configuration section to the location.
    static void
    playToLocation(@NotNull org.bukkit.Location loc, String soundName, float volume, float pitch)
    Play a sound to a location.
    static void
    playToPlayer(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.configuration.ConfigurationSection section)
    Plays the sound in the configuration section to the player.
    static void
    playToPlayer(@NotNull org.bukkit.entity.Player player, String soundName, float volume, float pitch)
    Play a sound to a player.
    static void
    playVanillaToLocation(@NotNull org.bukkit.Location loc, @NotNull org.bukkit.Sound sound, float volume, float pitch)
    Plays a vanilla sound to a location.
    static void
    playVanillaToPlayer(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.Sound sound, float volume, float pitch)
    Plays a vanilla sound to a player.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CUSTOM_PREFIX

      public static final String CUSTOM_PREFIX
      The prefix that the util will search for, used to determine if the plugin should play a vanilla sound or a custom sound (such as one in a resource pack).
      See Also:
  • Constructor Details

    • Sounds

      public Sounds()
  • Method Details

    • playToPlayer

      public static void playToPlayer(@NotNull @NotNull org.bukkit.entity.Player player, String soundName, float volume, float pitch)
      Play a sound to a player.
      Parameters:
      player - The player that should hear the sound
      soundName - The name of the sound, either the enum name for vanilla sounds, or a custom sound name prefixed with CUSTOM_PREFIX
      volume - The volume of the sound
      pitch - The pitch of the sound
    • playToPlayer

      public static void playToPlayer(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.configuration.ConfigurationSection section)
      Plays the sound in the configuration section to the player.
      Parameters:
      player - The player that will hear the sound
      section - The configuration section containing the sound
    • playToLocation

      public static void playToLocation(@NotNull @NotNull org.bukkit.Location loc, String soundName, float volume, float pitch)
      Play a sound to a location.
      Parameters:
      loc - The location the sound will be played
      soundName - The name of the sound, either the enum name for vanilla sounds, or a custom sound name prefixed with CUSTOM_PREFIX
      volume - The volume of the sound
      pitch - The pitch of the sound
    • playToLocation

      public static void playToLocation(@NotNull @NotNull org.bukkit.Location loc, @NotNull @NotNull org.bukkit.configuration.ConfigurationSection section)
      Plays the sound in the configuration section to the location.
      Parameters:
      loc - The location to play the sound
      section - The configuration section containing the sound
    • playVanillaToPlayer

      public static void playVanillaToPlayer(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.Sound sound, float volume, float pitch)
      Plays a vanilla sound to a player.
      Parameters:
      player - The player that will hear the sound
      sound - The vanilla sound to play
      volume - The volume of the sound
      pitch - The pitch of the sound
    • playCustomToPlayer

      public static void playCustomToPlayer(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull String sound, float volume, float pitch)
      Plays a custom sound to a player.
      Parameters:
      player - The player that will hear the sound
      sound - The custom sound to play
      volume - The volume of the sound
      pitch - The pitch of the sound
    • playVanillaToLocation

      public static void playVanillaToLocation(@NotNull @NotNull org.bukkit.Location loc, @NotNull @NotNull org.bukkit.Sound sound, float volume, float pitch)
      Plays a vanilla sound to a location.
      Parameters:
      loc - The location where the sound will be played
      sound - The vanilla sound to play
      volume - The volume of the sound
      pitch - The pitch of the sound
    • playCustomToLocation

      public static void playCustomToLocation(@NotNull @NotNull org.bukkit.Location loc, @NotNull @NotNull String sound, float volume, float pitch)
      Plays a custom sound to a location.
      Parameters:
      loc - The location where the sound will be played
      sound - The custom sound to play
      volume - The volume of the sound
      pitch - The pitch of the sound