> For the complete documentation index, see [llms.txt](https://alexmens.gitbook.io/chatplus/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alexmens.gitbook.io/chatplus/other-features/developer-api.md).

# Developer API

This plugin has also **API methods that allow developer**s to develop side-plugins.

## <mark style="color:blue;">How to import API</mark>

You have to get your copy of chatplus.jar and **import it in your project** (I recommend doing it from pom.xml or build.gradle) **and then add ChatPlus as depend or softdepend in this way:**

{% tabs %}
{% tab title="Softdepend" %}

```yaml
softdepend:
  - ChatPlus
```

{% endtab %}

{% tab title="Depend" %}

```yaml
depend:
  - ChatPlus
```

{% endtab %}
{% endtabs %}

## <mark style="color:blue;">Start using API</mark>&#x20;

All of the following methods **are in the ChatPlusAPI class** and they are statics methods so you can call it just **using ChatPlusAPI.\<method>...**

| <mark style="color:blue;">Method</mark> | <mark style="color:blue;">Arguments</mark>                   | <mark style="color:blue;">Description</mark>                                              |
| --------------------------------------- | ------------------------------------------------------------ | ----------------------------------------------------------------------------------------- |
| boolean createChat()                    | String chatName; String color; String chatPrefix             | Create a chat                                                                             |
| boolean deleteChat()                    | String chatName                                              | Delete a chat                                                                             |
| boolean addPlayerToAChat()              | String chatName, String player                               | Add a player to a chat                                                                    |
| boolean removePlayerFromAChat()         | String chatName; String player                               | Remove a player from a chat.                                                              |
| String getChatInfo()                    | String chatName;                                             | Return a string about the info of the chat.                                               |
| Inventory getChatInventory()            | Player player;                                               | Return the GUI of chats of that player.                                                   |
| boolean setPlayerName()                 | String chatName, String player, String newName               | Set the player's name in that chat.                                                       |
| boolean setPlayerPrefix()               | String chat, String player, String newPrefix                 | Set the player's prefix in that chat                                                      |
| boolean clearPlayerPrefix()             | String chat, String prefix                                   | Clear the player's prefix in that chat                                                    |
| boolean setGroupPrefix()                | String chat, String group, String newPrefix                  | Set the group's prefix in that chat                                                       |
| boolean clearGroupPrefix()              | String chat, String prefix                                   | Clear the group's prefix in that chat                                                     |
| void manageVisibility()                 | Player p, String chat                                        | Remove from enable list that player if the chat is enabled, enable if not or switch chat. |
| void returnToGlobal()                   | Player p;                                                    | Disable enabled chat.                                                                     |
| void enableChat()                       | Player p, String chat                                        | Enable the chat to a player                                                               |
| boolean sendMessage()                   | String chat, String message, CommandSender player            | Send a message to a chat as the player.                                                   |
| boolean sendMessageAsDiscord()          | String chat, String message, String playerName, String group | Send a message as coming from Discord from that player.                                   |

**!!Note:** The boolean methods returns true if goes good, false if an error occurs like chat not found.\
**!!Note**: Please consider to execute that methods async cause there a lot of reference to databases.
