# Quick Commands

# Quick Commands

Quick Commands allow you to create reusable command shortcuts for frequently used server commands. Access them from the sidebar menu.

## Overview

Quick Commands provide:
- **One-click execution** of complex commands
- **Organized categories** for better management
- **Custom naming** for easy identification
- **Shareable** across all panel users

## Creating Quick Commands

### Via the Panel

1. Navigate to **Quick Commands** in the sidebar
2. Click **Add Quick Command**
3. Fill in the details:
   - **Name**: Display name for the command
   - **Command**: The server command to execute
   - **Category**: Optional grouping (e.g., "Admin", "Events")
   - **Description**: Optional description

### Example Commands

| Name | Command | Category |
|------|---------|----------|
| Clear Weather | `/weather clear` | World |
| Set Day | `/time set day` | World |
| Heal All | `/effect @a instant_health 1 5` | Player |
| Event Mode | `/gamerule doDaylightCycle false` | Events |
| Server Restart Warning | `/say Server restarting in 5 minutes!` | Admin |

## Managing Commands

### Editing Commands

1. Find the command in the list
2. Click the **Edit** (pencil) icon
3. Modify the details
4. Click **Save**

### Deleting Commands

1. Find the command in the list
2. Click the **Delete** (trash) icon
3. Confirm deletion

### Organizing by Category

Commands are grouped by category:
- Commands without a category appear under "Uncategorized"
- Click on a category header to expand/collapse
- Categories are created automatically when you assign them

## Executing Commands

### Single Execution

1. Find the command in the list
2. Click the **Run** (play) icon
3. Command executes immediately
4. Output appears in the console

### From Dashboard

Quick Commands can also be accessed from the Dashboard widget for faster access to your most-used commands.

## API Reference

### Endpoints

| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | `/api/scheduler/quick-commands` | List all quick commands |
| POST | `/api/scheduler/quick-commands` | Create a new command |
| PUT | `/api/scheduler/quick-commands/:id` | Update a command |
| DELETE | `/api/scheduler/quick-commands/:id` | Delete a command |
| POST | `/api/scheduler/quick-commands/:id/execute` | Execute a command |

### Data Structure

```json
{
  "id": "uuid",
  "name": "Set Day",
  "command": "/time set day",
  "category": "World",
  "description": "Sets the time to day",
  "createdAt": "2024-01-15T10:30:00Z",
  "createdBy": "admin"
}
```

## Permissions

Quick Commands use the scheduler permissions:

| Permission | Description |
|------------|-------------|
| `scheduler.view` | View quick commands list |
| `scheduler.manage` | Create, edit, delete, and execute commands |

## Best Practices

1. **Use descriptive names** - Make it clear what the command does
2. **Group related commands** - Use categories for organization
3. **Document complex commands** - Use the description field
4. **Test before sharing** - Verify commands work correctly
5. **Limit destructive commands** - Be careful with commands that affect the world

## Tips

- Quick Commands support command chaining (multiple commands separated by `;`)
- Use variables like `@a` (all players), `@p` (nearest player), `@r` (random player)
- Commands are logged in the server console for auditing