changeSoundVolume()
changeSoundVolume
Method in MelodyManager
Class
changeSoundVolume
Method in MelodyManager
ClassThe changeSoundVolume
method is used to change the volume of a sound in the MelodyMine plugin. This method can change the volume of 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 for which the volume is to be changed.
sendToAll
boolean
Determines whether the volume should be changed for all players or not.
socketID
String
The socket ID of the player for whom the volume should be changed. This is ignored if sendToAll
is true
.
volume
double
The new volume level for the sound.
Example
Here is an example of how to use the changeSoundVolume
method in another plugin:
In this example, the changeVolumeForPlayer
method in the ExamplePlugin
class retrieves the MelodyPlayer
instance for the player using their UUID. It then uses the changeSoundVolume
method of the MelodyManager
class to change the volume of a sound for the player. If the volume is successfully changed, a message is logged to the console. If the player is not found, a warning is logged instead.
Last updated