> For the complete documentation index, see [llms.txt](https://syrows-development.gitbook.io/smartcommands/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://syrows-development.gitbook.io/smartcommands/commands/smartcommandsmanager.md).

# SmartCommandsManager

This is a guide to learn how to use the SmartCommandsManager class.

### What is SmartCommandsManager ?

`SmartCommandsManager` is a class which allows you to manage your commands. Indeed, it provides many features like checking if a command is loaded, getting a `SmartCommand` or reloading its contents.

You can get it by using the `getSmartCommandsManager()` method from the `SmartCommandsAPI` class.

```java
SmartCommandsAPI api = new SmartCommandsAPI.ApiBuilder().build(this);

SmartCommandsManager scManager = api.getSmartCommandsManager();
```

### Check if a command is loaded

This class allows you to check if a command is correcly loaded by using the `isLoaded(String name)` method which takes as parameter the name of the command you want to check.

{% hint style="info" %}
A command is considered as loaded if it meets two criteria:

1. The command is stored in the commands.json file without syntax errors.
2. Its contents has been loaded without errors (only if it has a contents file).
   {% endhint %}

```java
boolean isLoaded = scManager.isLoaded("item");
```

### Get a SmartCommand by name

You can use the `getSmartCommand(String name)` method to get the `SmartCommand` instance associated to a command.

{% hint style="info" %}
**SmartCommand** is a class used to store **command data**. You can read [this guide](https://syrows-development.gitbook.io/smartcommands/commands/smartcommand) to get more information about it.
{% endhint %}

```java
SmartCommand itemCommand = scManager.getSmartCommand("item");
```

### Reload command contents

This class also allows you to reload the contents of one or more command. To reload the contents of only one command, you can use the `reloadCommandContents(String name)` method which takes as parameter the name of the command you want to reload.

```java
scManager.reloadCommandContents("item");
```

If you want to reload the contents of all the commands registered by the plugin, just use the `reloadCommandContents()` method.

```java
scManager.reloadCommandContents();
```
