toggleCall()
toggleCall Method in MelodyManager Class
toggleCall Method in MelodyManager ClassMethod Signature
public void toggleCall(MelodyPlayer melodyPlayer)Parameters
Parameter
Type
Description
melodyPlayer
MelodyPlayer
The player whose call status is to be toggled.
Example
Here is an example of how to use the toggleCall method in another plugin:
import ir.taher7.melodymine.core.MelodyManager;
import ir.taher7.melodymine.models.MelodyPlayer;
public class ExamplePlugin {
public void togglePlayerCallStatus(String playerUUID) {
MelodyPlayer player = MelodyManager.INSTANCE.getMelodyPlayer(playerUUID);
if (player != null) {
MelodyManager.INSTANCE.toggleCall(player);
Bukkit.getLogger().info("Call status toggled for player " + player.getName());
} else {
Bukkit.getLogger().warning("Player not found.");
}
}
}In this example, the togglePlayerCallStatus method in the ExamplePlugin class retrieves the MelodyPlayer instance for the player using their UUID. It then uses the toggleCall method of the MelodyManager class to toggle the call status of the player. If the call status is successfully toggled, a message is logged to the console. If the player is not found, a warning is logged instead.
Last updated