# Chức năng mới

1️⃣ 🎖️ **Thưởng AFK theo Rank (Milestone Rank Reward)**

Người chơi sẽ **nhận phần thưởng đặc biệt** khi đạt mốc thời gian AFK cụ thể **dựa trên rank LuckPerms** của họ.

**🔧 Cấu hình `plugins/SharkAFK/rank-reward.yml`:**

```yaml
play-sound: true
sound: "ENTITY_PLAYER_LEVELUP"

milestones:
  600: # Sau 10 phút AFK
    default:
      commands:
        - "eco give %player% 100"
    vip:
      commands:
        - "give %player% diamond 3"
        - "say GG %player%"
  1800: # Sau 30 phút
    vip:
      commands:
        - "crate givekey %player% vote 1"
```

📌 **Mỗi mốc (600, 1800,...) có thể định nghĩa theo từng rank**.

🧠 **Tự động nhận dạng nhóm LuckPerms** của người chơi (`getPrimaryGroup`).

📝 **Phản hồi in-game**:

* Gửi title/sound
* Tin nhắn từ `lang.yml`:

```yaml
rank-milestone-reward:
  received: "&6🎁 Bạn đã đạt mốc rank &e%group%&6 và nhận được phần thưởng!"
  commands:
    success: "&a✔ Đã chạy lệnh thưởng cho mốc rank &f%group%"
```

2️⃣ 🛠️ Hệ thống Cấu hình AFK GUI & Hiển thị

> Quản lý thưởng theo giây: tiền, vật phẩm, lệnh, tỷ lệ (%)

```yaml
afk-rewards:
  300:
    ranks:
      default:
        shark-point: 5
        rewards:
          - "money:100"
          - "item:diamond:1|50"
          - "command:say %player% vừa nhận quà!"
```

***

### 🧩 Yêu cầu Plugin:

* LuckPerms (bắt buộc để sử dụng chức năng rank reward)
* Vault (nếu dùng `money:`)
* PlaceholderAPI (tùy chọn)

***

### 💡 Các Placeholder hỗ trợ (nếu tích hợp PAPI):

| Placeholder          | Mô tả                  |
| -------------------- | ---------------------- |
| `%sharkafk_afktime%` | Thời gian AFK hiện tại |
| `%sharkafk_isafk%`   | `true/false`           |

***

### 📂 File cấu hình mới

| File                    | Mục đích                               |
| ----------------------- | -------------------------------------- |
| `setting/sharktime.yml` | Cấu hình phần thưởng mốc thời gian AFK |
| `rank-reward.yml`       | Cấu hình phần thưởng mốc rank đặc biệt |
| `data/locationafk.yml`  | Lưu vùng AFK đã thiết lập              |

***

### 📌 Ghi chú

* **Không reset thời gian khi di chuyển nhẹ trong vùng AFK**.
* **Không bị reset mốc khi relog nếu vẫn trong vùng**.


---

# 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://kazamis.gitbook.io/kazami-studio/sharkafk-wiki/sharkafk/version/phien-ban-v1.0.2-release/chuc-nang-moi.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.
