Package net.glowstone.util
Class SoundUtil
java.lang.Object
net.glowstone.util.SoundUtil
A collection of utility methods to play sounds.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.SoundCategorybuildSoundCategory(String category) Convert a string to a SoundCategory.static voidplaySoundAtLocationExcept(org.bukkit.Location location, org.bukkit.Sound sound, float volume, float pitch, GlowPlayer... exclude) Plays a sound with a random pitch, but excludes specified players from hearing it.static voidplaySoundPitchRange(org.bukkit.Location location, org.bukkit.Sound sound, float volume, float pitchBase, float pitchRange, boolean allowNegative, GlowPlayer... exclude) Plays a sound with a random pitch, but excludes specified players from hearing it.static voidplaySoundPitchRange(org.bukkit.Location location, org.bukkit.Sound sound, float volume, float pitchBase, float pitchRange, GlowPlayer... exclude) Plays a sound with a random pitch, but excludes specified players from hearing it.static floatrandomReal(float range) Generates a random float between-rangeandrange.
-
Constructor Details
-
SoundUtil
public SoundUtil()
-
-
Method Details
-
playSoundAtLocationExcept
public static void playSoundAtLocationExcept(org.bukkit.Location location, org.bukkit.Sound sound, float volume, float pitch, GlowPlayer... exclude) Plays a sound with a random pitch, but excludes specified players from hearing it.- Parameters:
location- the sound locationsound- the sound to playvolume- the volume multiplierpitch- the pitch modifierexclude- the players not to play the sound for- Throws:
NullPointerException- if any of the location, sound, or exclude parameters is null.
-
playSoundPitchRange
public static void playSoundPitchRange(org.bukkit.Location location, org.bukkit.Sound sound, float volume, float pitchBase, float pitchRange, boolean allowNegative, GlowPlayer... exclude) Plays a sound with a random pitch, but excludes specified players from hearing it.- Parameters:
location- the sound locationsound- the sound to playvolume- the volume multiplierpitchBase- ifallowNegative, the average pitch modifier; otherwise, the minimumpitchRange- the maximum deviation of the pitch modifier compared topitchBaseallowNegative- if true, distribution is triangular rather than uniformexclude- the players not to play the sound for
-
playSoundPitchRange
public static void playSoundPitchRange(org.bukkit.Location location, org.bukkit.Sound sound, float volume, float pitchBase, float pitchRange, GlowPlayer... exclude) Plays a sound with a random pitch, but excludes specified players from hearing it.- Parameters:
location- the sound locationsound- the sound to playvolume- the volume multiplierpitchBase- the average pitch modifier.pitchRange- the maximum deviation of the pitch modifier compared topitchBaseexclude- the players not to play the sound for
-
randomReal
public static float randomReal(float range) Generates a random float between-rangeandrange.- Parameters:
range- the bounds of the random float.- Returns:
- A randomly generated float.
-
buildSoundCategory
Convert a string to a SoundCategory. The comparison is done on the name and is not case-sensitive.- Parameters:
category- The string name of the category- Returns:
- The matching SoundCategory, null if none.
-