PostPlaySoundEvent
PostPlaySoundEvent
The PostPlaySoundEvent
is a custom event in the MelodyMine plugin. This event is triggered after a sound is played in the client for player. It provides information about the sound that was played, whether it was sent to all players, the socket ID of the player who triggered the sound, and the volume of the sound.
Class Attributes
soundName
String
The name of the sound that was played.
sendToAll
Boolean
Indicates whether the sound was sent to all players.
socketID
String
The socket ID of the player who triggered the sound.
volume
Double
The volume at which the sound was played.
Listening to the Event
To listen to this event, you need to create a class that implements the Listener
interface from the Bukkit API. Inside this class, you can then define a method annotated with @EventHandler
to handle the PostPlaySoundEvent
.
Here is an example:
In this example, the onPostPlaySound
method is called whenever a PostPlaySoundEvent
is triggered. The method retrieves the name of the sound and the socket ID of the player who triggered the sound, and then logs this information to the console.
Remember to register your event listener with the Bukkit plugin manager to ensure that your @EventHandler
methods are called when the events are triggered.
Last updated