# Command List

KaMenu provides a concise command system. The main command is `/km`(or `/kamenu`and`/menu`).

***

## Main command

```
/km <subcommand> [arguments]
```

**Aliases:** `/kamenu`and`/menu`

***

## Subcommand details

### /km help

Displays command help information.

**Format:** `/km help`

**Permission:** None (available to all players and everyone)

**Example:**

```bash
/km help
```

**Displayed content:**

* Plugin version information
* List of all available subcommands
* Brief description of each command

{% hint style="info" %}
Entering `/km`(with no arguments) will also automatically display help information.
{% endhint %}

***

### /km open

Opens a specified menu.

**Format:**

* `/km open <menu ID>` - Open the menu for yourself (players only)
* `/km open <menu ID> <player>` - Open the menu for a specified player (console supported)

**Permission:** `kamenu.admin`

**Tab completion:** Entering `/km open` Press Tab afterward to automatically complete all loaded menu IDs (including subfolder paths)

**Example:**

```bash
# Player opens a menu for themselves
/km open main_menu

# Player opens a menu for a specified player
/km open shop/weapons Player1

# Console opens a menu for a specified player (player must be specified)
/km open example/actions_demo Player1

# Open a menu in a subfolder
/km open shop/weapons
```

**Instructions:**

* If the menu ID does not exist, the player will receive an error message
* Players can omit the second argument; by default, the menu opens for themselves
* The console must specify the second argument (player name)
* If the specified player does not exist, an error message will be received

{% hint style="warning" %}
Because this command can open any menu, `kamenu.admin` permission is required. It is recommended to use [custom commands](/plugins/kamenu-en/config/customcommands.md) to provide players with a safer way to access menus.
{% endhint %}

***

### /km list

View a list of all loaded menus on the server.

**Format:** `/km list [page number]`

**Permission:** `kamenu.admin`

**Features:**

* Displays all loaded menus (10 per page)
* Click the menu name to open it directly
* Supports paginated browsing
* Uses clickable text for convenient interaction

**Example:**

```bash
# View the first page of the menu list
/km list

# View a specified page
/km list 2
```

**Display:**

```

§6§lMenu List
§f1. example/main_menu §e[Click to open]
§f2. example/shop_menu §e[Click to open]
§f3. example/vip_menu §e[Click to open]
...
§7[Previous Page]  §7Page 1/3  §e[Next Page]

```

***

### /km reload

Reload all plugin configuration files and menu files without restarting the server.

**Format:** `/km reload`

**Permission:** `kamenu.admin`

**Reloaded content:**

1. `config.yml` Global configuration
2. Language files (`lang/` directory)
3. `menus/` all menu files under the directory (including subfolders)
4. Custom command registration

**Example:**

```bash
/km reload
# Output: [KaMenu] Menus reloaded, 12 menus and 3 custom commands loaded in total.
```

{% hint style="info" %}
After modifying menu files, just run `/km reload` and it will take effect immediately without restarting the server.
{% endhint %}

***

### /km item

Manage saved items, including saving the held item, giving saved items, and deleting saved items.

**Format:**

* `/km item save <item name>` - Save the held item to the database (players only)
* `/km item give <item name>` - Give 1 item to yourself (players only)
* `/km item give <item name> <quantity>` - Give the specified quantity of items to yourself (players only)
* `/km item give <item name> <player>` - Give 1 item to the specified player (console supported)
* `/km item give <item name> <player> <quantity>` - Give the specified quantity of items to the specified player (console supported)
* `/km item delete <item name>` - Delete a saved item

**Permission:** `kamenu.admin`

**Feature description:**

* Items are serialized and stored in the database in Base64 format
* Supports all item types (including items with NBT tags)
* Can save complex items such as enchanted items and items with special materials
* When saving an item, the quantity is automatically set to 1 to avoid saving quantity information
* When giving items, the quantity can be specified, range 1-64
* Deleting an item will permanently remove it from the database

**Example:**

```bash
# Save held item
/km item save diamond_sword
/km item save vip_reward

# Give 1 item to yourself
/km item give diamond_sword

# Give 10 items to yourself
/km item give diamond_sword 10

# Give 1 item to a specified player
/km item give vip_reward Player1

# Give 10 items to a specified player
/km item give vip_reward Player1 10

# Console gives items to a specified player (player must be specified)
/km item give diamond_sword Player1

# Console gives multiple items to a specified player
/km item give diamond_sword Player1 5

# Delete saved item
/km item delete diamond_sword
/km item delete vip_reward
```

**Tab completion:**

* Entering `/km item` Press Tab afterward to display subcommands (save, give, delete)
* Entering `/km item give` Press Tab afterward to display all saved item names
* Entering `/km item delete` Press Tab afterward to display all saved item names
* After entering the item name and pressing Tab, all online players will be displayed (give command only)

{% hint style="warning" %}

* The save command can only be used by players; the console cannot use it
* In the give command, the player argument is optional; if omitted, it defaults to yourself. The console must specify a player
* The quantity argument is optional, defaults to 1, range 1-64
* Cannot save when the held item is empty
* If the player's inventory is full, the remaining items cannot be given
  {% endhint %}

***

### /km action

Test executing a specified action, convenient for debugging and verifying action configuration.

**Format:** `/km action <player> <action>`

**Permission:** `kamenu.admin`

**Instructions:** This command can be used by players and the console, and a target player must be specified.

**Supported action types:**

* `tell:message` - Send a chat message
* `actionbar:message` - Send an ActionBar message
* `title:parameters` - Send a title
* `sound:parameters` - Play a sound
* `command:command` - Player executes command
* `console:command` - Console executes command
* `data:operation` - Player data operation
* `gdata:operation` - Global data operation
* `meta:operation` - Metadata operation

  For detailed action types, please refer to [🤖 Actions](/plugins/kamenu-en/menu/actions.md).

***

**Example:**

```bash
# Send message
/km action Player1 tell:Hello World

# Play sound
/km action Player2 sound:block_note_block_harp;volume=1.0;pitch=1.0

# Send title
/km action Player3 title:title=Test;subtitle=Subtitle

# Operate data
/km action Player4 data:type=set;key=test;var=100

# Supports variables and PAPI
/km action Player5 tell: Your level is %player_level%, and your points are {data:score}
```

**Tab completion:**

* Entering `/km action` Press Tab afterward to display all online players
* After entering a player name and pressing Tab, common action prefixes will be displayed

{% hint style="info" %}
This command supports all built-in variables (`{data:var}`and`{gdata:var}`and`{meta:var}`) and PlaceholderAPI variables (`%player_name%` and so on).
{% endhint %}

***

## Custom shortcut commands

In addition to `/km open` you can also register custom shortcut commands in `config.yml` to directly map a short command to opening a certain menu:

```yaml
custom-commands:
  shop: 'server_shop'   # When a player runs /shop, the server_shop menu opens
  menu: 'main_menu'     # When a player runs /menu, the main_menu menu opens
```

For detailed configuration, please refer to [⌨️ Custom Commands](https://github.com/Katacr/KaMenu/blob/main/docs/home/commands.md).


---

# 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://katacr.gitbook.io/plugins/kamenu-en/perm/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.
