Minecord Developers API: Documentation

May 22, 2019 at 4:18 PM
Minecord Developers API: Documentation
  • Minecord Developers API Wiki: Documentation


    Usage
    In order to hook your plugin into Minecord system you will need to access through this developers API. For so, make sure that your plugin will be runned in a server with the Minecord plugin (and all the necessary modules & dependencies) and, of course, the Minecord-API plugin. For that reason, you have to add Minecord and Minecord-API as dependencies of your plugin (inside your plugin.yml file).
    Code (YAML):
    depend: [Minecord, Minecord-API]

    At this moment you can add Minecord-API as a local dependency to your project by downloading it from the main page of the resource and then follow adding it with the help of your IDE. However, there is also a Maven repository for this project available, so that you can add the dependency without downloading it if you have a Maven project. More info about this repository in its wiki page.

    Once you have included the dependency in your project you need to retrieve the API from the code. In order to do that, you need to do an static reference to the MinecordAPI class to getAPI() method. That will return an object of type MAPI which contains all the methods explained in the following section.
    Code (Java):
    final MAPI minecordAPI = MinecordAPI.getAPI();

    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...