package net.knarcraft.blacksmith.event; import net.citizensnpcs.api.npc.NPC; import org.bukkit.Sound; import org.bukkit.SoundCategory; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; /** * An event triggered when an NPC plays a sound indicating an action */ @SuppressWarnings("unused") public class NPCSoundEvent extends AbstractBlacksmithPluginEvent implements Cancellable { private static final HandlerList handlers = new HandlerList(); private boolean cancelled; private float pitch; private float volume; private SoundCategory soundCategory; private Sound sound; /** * Instantiates a new NPC sound event * * @param npc

The NPC playing the sound

* @param player

The player whose interaction triggered the sound

* @param soundCategory

The category the sound is to play in

* @param sound

The sound to play

* @param volume

The volume of the played sound

* @param pitch

The pitch of the played sound

*/ public NPCSoundEvent(@NotNull NPC npc, @NotNull Player player, @NotNull SoundCategory soundCategory, @NotNull Sound sound, float volume, float pitch) { super(npc, player); this.soundCategory = soundCategory; this.sound = sound; this.volume = volume; this.pitch = pitch; } /** * Gets the pitch of the played sound * * @return

The pitch of the played sound

*/ public float getPitch() { return this.pitch; } /** * Gets the volume of the played sound * * @return

The volume of the played sound

*/ public float getVolume() { return this.volume; } /** * Gets the category the sound is played in * * @return

The sound category used

*/ public @NotNull SoundCategory getSoundCategory() { return this.soundCategory; } /** * Gets the sound to play * * @return

The sound to play

*/ public @NotNull Sound getSound() { return this.sound; } /** * Sets the pitch of the played sound * * @param pitch

The new pitch

*/ public void setPitch(float pitch) { this.pitch = pitch; } /** * Sets the volume of the played sound * * @param volume

The new volume

*/ public void setVolume(float volume) { this.volume = volume; } /** * Sets the sound to play * * @param sound

The new sound to play

*/ public void setSound(@NotNull Sound sound) { this.sound = sound; } /** * Sets the category the sound is played in * * @param soundCategory

The new sound category

*/ public void setSoundCategory(@NotNull SoundCategory soundCategory) { this.soundCategory = soundCategory; } @Override public boolean isCancelled() { return this.cancelled; } @Override public void setCancelled(boolean cancelled) { this.cancelled = cancelled; } /** * Gets a handler-list containing all event handlers * * @return

A handler-list with all event handlers

*/ @NotNull @SuppressWarnings("unused") public static HandlerList getHandlerList() { return handlers; } @Override @NotNull public HandlerList getHandlers() { return handlers; } }