Package dev.demeng.pluginbase
Class Sounds
java.lang.Object
dev.demeng.pluginbase.Sounds
Various utilities for playing sound effects.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe 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 -
Method Summary
Modifier and TypeMethodDescriptionstatic voidplayCustomToLocation(@NotNull org.bukkit.Location loc, @NotNull String sound, float volume, float pitch) Plays a custom sound to a location.static voidplayCustomToPlayer(@NotNull org.bukkit.entity.Player player, @NotNull String sound, float volume, float pitch) Plays a custom sound to a player.static voidplayToLocation(@NotNull org.bukkit.Location loc, @NotNull org.bukkit.configuration.ConfigurationSection section) Plays the sound in the configuration section to the location.static voidplayToLocation(@NotNull org.bukkit.Location loc, String soundName, float volume, float pitch) Play a sound to a location.static voidplayToPlayer(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.configuration.ConfigurationSection section) Plays the sound in the configuration section to the player.static voidplayToPlayer(@NotNull org.bukkit.entity.Player player, String soundName, float volume, float pitch) Play a sound to a player.static voidplayVanillaToLocation(@NotNull org.bukkit.Location loc, @NotNull org.bukkit.Sound sound, float volume, float pitch) Plays a vanilla sound to a location.static voidplayVanillaToPlayer(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.Sound sound, float volume, float pitch) Plays a vanilla sound to a player.
-
Field Details
-
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 soundsoundName- The name of the sound, either the enum name for vanilla sounds, or a custom sound name prefixed withCUSTOM_PREFIXvolume- The volume of the soundpitch- 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 soundsection- 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 playedsoundName- The name of the sound, either the enum name for vanilla sounds, or a custom sound name prefixed withCUSTOM_PREFIXvolume- The volume of the soundpitch- 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 soundsection- 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 soundsound- The vanilla sound to playvolume- The volume of the soundpitch- 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 soundsound- The custom sound to playvolume- The volume of the soundpitch- 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 playedsound- The vanilla sound to playvolume- The volume of the soundpitch- 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 playedsound- The custom sound to playvolume- The volume of the soundpitch- The pitch of the sound
-