checkPlayerWebConnection()

checkPlayerWebConnection Method in MelodyManager Class

The checkPlayerWebConnection method is used to verify the web connection of a player in the MelodyMine plugin. This method checks if the player is online on the web.

Method Signature

public void checkPlayerWebConnection(MelodyPlayer player)

Parameters

ParameterTypeDescription

player

MelodyPlayer

The player whose web connection is to be checked.

Example

Here is an example of how to use the checkPlayerWebConnection method in another plugin:

import ir.taher7.melodymine.core.MelodyManager;
import ir.taher7.melodymine.models.MelodyPlayer;

public class ExamplePlugin {

    public void checkWebConnection(String playerUUID) {
        MelodyPlayer player = MelodyManager.INSTANCE.getMelodyPlayer(playerUUID);

        if (player != null) {
            MelodyManager.INSTANCE.checkPlayerWebConnection(player);
            Bukkit.getLogger().info("Checking web connection for player " + player.getName());
        } else {
            Bukkit.getLogger().warning("Player not found.");
        }
    }
}

In this example, the checkWebConnection method in the ExamplePlugin class retrieves the MelodyPlayer instance for the player using their UUID. It then uses the checkPlayerWebConnection method of the MelodyManager class to check the player's web connection. If the check is successfully initiated, a message is logged to the console. If the player is not found, a warning is logged instead.

Last updated