Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Commit 90f76ed

Browse files
committed
add item cooldowns
1 parent 7bf60a2 commit 90f76ed

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

.vitepress/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export default defineConfig({
8888
text: "Player",
8989
items: [
9090
{ text: "Resourcepack", link: "wiki/resourcepacks" },
91+
{ text: "Item/Group Cooldowns", link: "wiki/item-cooldowns" },
9192
],
9293
},
9394
{

wiki/item-cooldowns.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Item/Group Cooldowns
2+
3+
## Overview
4+
5+
Item/Group cooldowns allow users to set cooldown on either item or an group (string) for players
6+
7+
The `ItemGroupCooldown` class contains:
8+
- `group` which is a string
9+
- `startTime` which is a unix time in milliseconds of when the cooldown started
10+
- `durationTicks` which is how long the cooldown should last for in ticks
11+
12+
::: tip KEEP IN MIND
13+
Cooldowns will only work with player entities that have ticking enabled
14+
:::
15+
16+
## Usage
17+
18+
You can set cooldown of an Item like this:
19+
```kotlin
20+
player.setCooldown(item, 20)
21+
```
22+
23+
or you can use custom group:
24+
25+
```kotlin
26+
player.setCooldown(string, 20)
27+
```
28+
29+
You can use `player.isOnCooldown(item)` or `player.isOnCooldown(string)` to check if player has cooldown on an Item or group.
30+
31+
If you want to get the `ItemGroupCooldown` object from player, it is a `MutableMap<String, ItemGroupCooldown>` on the player object.
32+
33+
There is no way in minecraft to remove a cooldown, but you can set cooldown of the same item/group with 0 duration which will clear it
34+
35+
::: tip KEEP IN MIND
36+
Dockyard does not cancel any right-click/interaction events with items on cooldown
37+
:::
38+

0 commit comments

Comments
 (0)