stopSound()
stopSound
Method in MelodyManager
Class
stopSound
Method in MelodyManager
ClassThe stopSound
method is used to stop a sound in the MelodyMine plugin. This method can stop a sound for a specific player or for all players, depending on the parameters passed.
Method Signature
Parameters
soundName
String
The name of the sound to be stopped.
sendToAll
boolean
Determines whether the sound should be stopped for all players or not.
socketID
String
The socket ID of the player for whom the sound should be stopped. This is ignored if sendToAll
is true
.
Example
Here is an example of how to use the stopSound
method in another plugin:
In this example, the stopSoundForPlayer
method in the ExamplePlugin
class retrieves the MelodyPlayer
instance for the player using their UUID. It then uses the stopSound
method of the MelodyManager
class to stop a sound for the player. If the sound is successfully stopped, a message is logged to the console. If the player is not found, a warning is logged instead.
Last updated