# 🧰 Custom Commands

It is useful for commands such as `/discord`, `/store`, `/web`, or any other informational command you want to handle from the Velocity proxy.

***

### What It Does

The Custom Commands module lets you define commands directly from the configuration file.

It can be used for:

* Discord commands
* Store commands
* Website commands
* Rules commands
* Vote commands
* Social media commands
* Informational commands
* Clickable messages
* Hover messages
* Command actions
* Cooldown-controlled utility commands
* Permission-based command access

***

### When To Enable It

Enable this module if you want NexusProxy to handle simple custom commands without installing another plugin.

This module is useful for:

* Network links
* Server information
* Store promotion
* Discord promotion
* Website links
* Common player shortcuts
* Rank-specific commands

***

### Requirements

The Custom Commands module does not require external dependencies.

| Dependency     | Required | Purpose       |
| -------------- | -------- | ------------- |
| Redis          | No       | Not required. |
| MySQL          | No       | Not required. |
| MongoDB        | No       | Not required. |
| PacketEvents   | No       | Not required. |
| Discord        | No       | Not required. |
| PlaceholderAPI | No       | Not required. |

***

### Configuration File

The Custom Commands module configuration file is located at:

```
plugins/NexusProxy/modules/customcommands/customcommands.yml
```

This file can contain settings for:

* Module status
* Custom command definitions
* Command names
* Command aliases
* Permissions
* Cooldowns
* Messages
* Hover text
* Click actions
* Command actions
* Sound actions
* Player-only behavior
* Console behavior

{% hint style="warning" %}
Custom commands are created and controlled from the module configuration file.

The commands shown here are only default examples.
{% endhint %}

***

### Default Example Commands

| Command    | Description                                |
| ---------- | ------------------------------------------ |
| `/discord` | Shows the network Discord link or message. |
| `/store`   | Shows the network store link or message.   |
| `/web`     | Shows the network website link or message. |

{% hint style="info" %}
These commands can usually be edited, removed, or replaced in `customcommands.yml`.
{% endhint %}

***

### Permissions

| Permission                                  | Description                                          |
| ------------------------------------------- | ---------------------------------------------------- |
| `nexusproxy.customcommands.cooldown.bypass` | Allows bypassing custom command cooldowns.           |
| `commands.<command>.permission`             | Permission configured for a specific custom command. |

Example permission concept:

```
nexusproxy.customcommands.discord
nexusproxy.customcommands.store
nexusproxy.customcommands.web
```

{% hint style="warning" %}
The exact permission for each custom command depends on your `customcommands.yml` configuration.
{% endhint %}

***

### Recommended LuckPerms Setup

#### Default players

```
/lp group default permission set nexusproxy.customcommands.discord true
/lp group default permission set nexusproxy.customcommands.store true
/lp group default permission set nexusproxy.customcommands.web true
```

#### Staff or admin cooldown bypass

```
/lp group staff permission set nexusproxy.customcommands.cooldown.bypass true
```

{% hint style="info" %}
Use the real permissions configured inside `customcommands.yml`.

The permissions above are examples.
{% endhint %}

***

### Example Command Structure

A custom command can usually define:

* Name
* Aliases
* Permission
* Cooldown
* Messages
* Click actions
* Hover text
* Commands to execute

Example concept:

```yaml
commands:
  discord:
    enabled: true
    name: "discord"
    aliases:
      - "dc"
    permission: "nexusproxy.customcommands.discord"
    cooldown: 5
    messages:
      - "&9&lDiscord &8» &fJoin our Discord server:"
      - "&bdiscord.example.net"
```

{% hint style="info" %}
The exact configuration format may differ depending on your generated `customcommands.yml`.

Use the generated file as the source of truth.
{% endhint %}

***

### Discord Command

A common use case is a Discord command.

Example command:

```
/discord
```

Example output:

```
Discord » Join our Discord server: discord.example.net
```

This is useful for sending players to your community Discord.

***

### Store Command

A store command can show your donation or rank store link.

Example command:

```
/store
```

Example output:

```
Store » Visit our store: store.example.net
```

This is useful for ranks, cosmetics, keys, subscriptions, or supporter perks.

***

### Website Command

A website command can show your main network website.

Example command:

```
/web
```

Example output:

```
Website » Visit our website: www.example.net
```

***

### Cooldowns

Custom commands can use cooldowns to prevent spam.

Players with this permission can bypass cooldowns:

```
nexusproxy.customcommands.cooldown.bypass
```

Cooldowns are useful for public commands such as:

* `/discord`
* `/store`
* `/web`
* `/vote`
* `/rules`

{% hint style="info" %}
Short cooldowns are usually enough for simple informational commands.
{% endhint %}

***

### Aliases

Each custom command can have aliases depending on configuration.

Example:

```yaml
commands:
  discord:
    name: "discord"
    aliases:
      - "dc"
      - "disc"
```

This allows players to use:

```
/discord
/dc
/disc
```

***

### Clickable Messages

Custom commands can be used to send clickable links if your configuration supports click actions.

Example concept:

```yaml
click:
  action: "OPEN_URL"
  value: "https://discord.example.net"
```

Use clickable messages for:

* Discord invites
* Store links
* Website links
* Vote links
* Support pages

***

### Hover Text

Hover text can show extra information when players hover over a message.

Example concept:

```yaml
hover:
  - "&7Click to open our Discord."
```

This makes simple utility commands feel more polished.

***

### Command Actions

Custom commands may also run configured actions or commands.

This can be useful for:

* Sending the player to another server
* Opening menus through another plugin
* Running proxy commands
* Sending multiple messages
* Triggering sounds or effects

{% hint style="warning" %}
Be careful with command actions.

Do not configure commands that give rewards, permissions, or ranks unless you fully trust the setup.
{% endhint %}

***

### Common Use Cases

#### Show Discord link

```
/discord
```

***

#### Show store link

```
/store
```

***

#### Show website link

```
/web
```

***

#### Give players access to a custom command

```
/lp group default permission set nexusproxy.customcommands.discord true
```

***

#### Give staff cooldown bypass

```
/lp group staff permission set nexusproxy.customcommands.cooldown.bypass true
```

***

### Setup Tips

* Use this module for simple information commands.
* Keep command messages short and clean.
* Use aliases for common shortcuts.
* Add cooldowns to prevent spam.
* Use clear permissions for each command.
* Use clickable links for Discord, store, website, and vote commands.
* Do not create custom commands that conflict with important commands from other plugins.
* Check `customcommands.yml` if you want to add, remove, rename, or modify commands.

***

### Common Issues

#### Custom command does not work

Check that:

* The Custom Commands module is enabled.
* The custom command is enabled in `customcommands.yml`.
* The player has the required permission.
* The command name is typed correctly.
* NexusProxy was reloaded or restarted after editing the config.
* Another plugin is not using the same command.

***

#### Player has no permission

Check that:

* The command has a permission configured.
* The player has that exact permission.
* The permission is assigned in the correct LuckPerms context if you use contexts.
* The permission in LuckPerms matches the one in `customcommands.yml`.

***

#### Command is blocked by cooldown

Check that:

* The cooldown value is configured correctly.
* The player is not currently on cooldown.
* Staff or admins have `nexusproxy.customcommands.cooldown.bypass` if needed.

***

#### Clickable link does not open

Check that:

* The click action is configured correctly.
* The URL is valid.
* The URL includes `https://` if required.
* The message component format is valid.

***

#### Another plugin is using the same command

If another plugin registers the same command or alias, change the command name or aliases in:

```
plugins/NexusProxy/modules/customcommands/customcommands.yml
```

***

### Summary

The Custom Commands module provides a simple way to create configurable utility commands from NexusProxy.

It is recommended for networks that want proxy-side commands such as `/discord`, `/store`, `/web`, `/vote`, `/rules`, or other informational shortcuts.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nexusproxy.nemesismc.net/modules/custom-commands.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
