Minecord Wiki: Developers API

Jul 20, 2019
Minecord Wiki: Developers API
  • Minecord Developers API Wiki: Documentation


    Usage
    Firstly, your plugin.yml must have as a dependency Minecord plugin:
    Code (YAML):
    depend: [Minecord]
    In order to hook your plugin into Minecord system, you will need to retrieve the Minecord API Service from the Server. No extra libraries are needed for this since Minecord already registers the Minecord API on enable.
    Code (Java):
    MAPI minecordAPI = getServer().getServicesManager().load(MAPI.class);
    From that minecordAPI variable, you will be able to access all the methods listed below. However, make sure that you added as a dependency to your project (with scope provided) the following:

    Likewise, make sure you are adding Minecord as a local dependency with provided as scope.

    Available methods & documentation
    The API is fully documented and has javadocs for every method, however, here it will be provided a more in-detail description of each available method of the API.

    isOfflinePlayerLinked (boolean)
    Check whether or not the given player has their Minecraft account in the server linked to their Discord account through Minecord.
    Argument/s: OfflinePlayer (The player to check their linking status. Cannot be null.)
    Returns: Whether or not the given player is linked.

    isMemberLinked (boolean)
    Check whether or not the given member has their Discord account in the server linked to their Minecraft account through Minecord.
    Argument/s: Member (The member to check their linking status. Cannot be null.)
    Returns: Whether or not the given member is linked.

    getOfflinePlayerFromLinkedMember (OfflinePlayer)
    If the given member's Discord account is linked, get the correspondent player's Minecraft account to what the member is linked through Minecord.
    Argument/s: Member (The member whose Discord account is linked to the player's Minecraft account through Minecord. Cannot be null.)
    Returns: The player whose Minecraft account is linked to the given member's Discord account. Otherwise, null.

    getMemberFromLinkedOfflinePlayer (Member)
    If the given member's Discord account is linked, get the correspondent player's Minecraft account to what the member is linked through Minecord.
    Argument/s: OfflinePlayer (The player whose Minecraft account is linked to the member's Discord account through Minecord. Cannot be null.)
    Returns: The member whose Discord account linked is to the given player's Minecraft account. Otherwise, null.

    getOfflinePlayerVoiceChatState (boolean)
    Get the state, so whether or not is enabled, of the voice chat of the given player.
    Argument/s: OfflinePlayer (The player to check their voice chat state. Cannot be null.)
    Returns: Whether or not the given player's voice chat is enabled.

    setOfflinePlayerVoiceChatState (void)
    Set the voice chat state of the given player to the given value.
    Argument/s: OfflinePlayer (The player to change their voice chat state. Cannot be null.); boolean (The new voice chat state of the player.)

    isOfflinePlayerMuted (boolean)
    Check whether or not the given player is muted from Minecord, and so prevented from using the voice chat.
    Argument/s: OfflinePlayer (The player to check their mute status. Cannot be null.)
    Returns: Whether or not the given player is muted.

    setOfflinePlayerMuted (void)
    Set the mute status of the given player to the given value.
    Argument/s: OfflinePlayer (The player to change their mute status. Cannot be null.); boolean (The new mute status of the given player.)

    isMemberConnected (boolean)
    Check whether or not the given member is connected to a Minecord channel.
    Argument/s: Member (The player to check their Voice connection. Cannot be null.)
    Returns: Whether or not the given player is connected to a Voice.

    getMemberVoiceConnected (Voice)
    If the given member is in a Minecord channel, get the Voice to which the member is connected.
    Argument/s: Member (The member to get from the Voice. Cannot be null.)
    Returns: The Voice to which the given member is connected. Otherwise, null.

    isVoice (boolean)
    Check whether or not the given Discord voice channel is a registered Voice from Minecord.
    Argument/s: VoiceChannel (The voice channel to check if it is a Voice.)
    Returns: Whether or not the given voice channel is a Voice.

    createVoice (Voice)
    Create a Voice of the type OTHER and with a random four-digit id and connect two members to the created voice.
    Argument/s: Member (The first member to connect to the new Voice. Does not matter if the member is already connected to a Voice. Cannot be null.); Member (The second member to connect to the new Voice. Does not matter if the member is already connected to a Voice. Cannot be null.)
    Returns: The created Voice, probably under the internal state of pending until Discord API fully creates the channel and connects the members.

    deleteVoice (void)
    If the given Voice is of type OTHERS, delete the given Voice and kick every member from there.
    Argument/s: Voice (The Voice to be deleted. Cannot be null.)
    Throws: UnsupportedOperationException (If the given Voice is not of type OTHERS.)

    Note: if any of the arguments labeled with "Cannot be null" is null, it will throw a NullPointerException.
  • Loading...
  • Loading...