Skip to content

Commit 99cefea

Browse files
committed
in-usage.md file created.
1 parent c627daf commit 99cefea

File tree

1 file changed

+195
-0
lines changed

1 file changed

+195
-0
lines changed

documentation/in-using.md

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
> ## Documentation for basically using CooldownAPI.
2+
3+
## 1. For playing and running minecraft:
4+
5+
#### 1.1 Download Cooldown API mod module.
6+
7+
Visit **Cooldown API** repository on github, visit **releases** tab and download `.jar` files of latest _pre-release_ / release (**recommended**)
8+
9+
Releases page: https://github.com/ProjectEssentials/ProjectEssentials-Cooldown/releases
10+
11+
12+
#### 1.2 Install Cooldown API modification.
13+
14+
The minecraft forge folder structure below will help you understand what is written below.
15+
16+
Also don't forget install dependency:
17+
- core: https://github.com/ProjectEssentials/ProjectEssentials-Core/releases
18+
- permissions: https://github.com/ProjectEssentials/ProjectEssentials-Permissions/releases
19+
20+
```
21+
.
22+
├── assets
23+
├── config
24+
├── libraries
25+
├── mods (that's how it should be)
26+
│ ├── Project Essentials Permissions-1.14.4-X.X.X.X.jar
27+
│ ├── Project Essentials Cooldown-1.14.4-X.X.X.X.jar
28+
│ └── Project Essentials Core-MOD-1.14.4-1.X.X.X.jar
29+
└── ...
30+
```
31+
32+
Place your mods and Cooldown API mods according to the structure above.
33+
34+
#### 1.3 Verifying mod on the correct installation.
35+
36+
Run the game, check the number of mods, if the list of mods contains `Project Essentials Cooldown` mod, then the mod has successfully passed the initialization of the modification.
37+
38+
After that, go into a single world, then try to write the `/essentials cooldown` command, if you **get an error** that you do not have permissions, then the modification works as it should.
39+
40+
#### 1.4 Control cooldowns via minecraft commands.
41+
42+
We just made the commands for you:
43+
44+
```
45+
/essentials cooldown
46+
47+
OR
48+
49+
/essentials cooldown version
50+
51+
- description: base command of cooldown api module; just send you about message.
52+
53+
- permission: ess.cooldown or ess.stuff or ess.cooldown.version
54+
```
55+
56+
```
57+
/essentials cooldown save
58+
59+
- description: save cooldown configuration.
60+
61+
- permission: ess.cooldown.save or ess.stuff
62+
```
63+
64+
```
65+
/essentials cooldown reload
66+
67+
- description: reload cooldown configuration !!!without saving.
68+
69+
- permission: ess.cooldown.save or ess.stuff
70+
```
71+
72+
## 2. For developing and developers:
73+
74+
### 2.1 Getting started with installing.
75+
76+
To get the Cooldown API source for development and interactions with the command cooldowns, you need to get the dependencies and get the documentation to view it in your IDE.
77+
78+
Installation documentation is located in the readme file or just follow the link: https://github.com/ProjectEssentials/ProjectEssentials-Cooldown#-install-using-gradle
79+
80+
### 2.2 Configuration.
81+
82+
Like many modifications, the Cooldown API has its own modification; it stores groups of players, players, and other necessary data related to rights. The configuration is in `json` format, which is convenient for reading and understanding even the **most stupid person**.
83+
84+
#### 2.2.1 Configuration file Location.
85+
86+
Due to the different file structure on the server and the client of the minecraft, technically we must use different paths for the two sides.
87+
88+
The differences in the paths are primarily due to the different locations of the kernel of minecraft version, but for the average person, the paths will be exactly the same, i.e. like that.
89+
90+
server: ./config/ProjectEssentials/cooldown.json
91+
client: ./config/ProjectEssentials/cooldown.json
92+
93+
#### 2.2.2 Configuration file structure.
94+
95+
##### 2.2.2.1 `CommandCooldowns` configuration section.
96+
97+
`CommandCooldowns` contains an array of command cooldowns, each element of the array (cooldown) must have the `command name` and `cooldown value`; it looks like "heal:10" where heal it command and 10 it command cooldown (in seconds).
98+
99+
**note:** also, if you need set common cooldown for any command, just use literals "*", "all", "any", i.e "any:5", where any random command and 5 it command cooldown (in seconds).
100+
101+
##### 2.2.2.2 `IgnoredPlayers` configuration section.
102+
103+
`IgnoredPlayers` contains an array of player nicknames; Just it contain players what not get restrictions on the use of commands.
104+
105+
##### 2.2.2.3 Just in case.
106+
107+
If something goes according to the cunt, and your configuration flies, just delete the configuration or take the default configuration from here.
108+
109+
**Default configuration**:
110+
111+
```json
112+
{
113+
"CommandCooldowns": [
114+
],
115+
"IgnoredPlayers": [
116+
]
117+
}
118+
```
119+
120+
### 2.3 API usage.
121+
122+
```
123+
CooldownAPI.DEFAULT_COOLDOWN
124+
125+
- description: Default command cooldown (in seconds).
126+
127+
- note: it value be using as callback, e.g if cooldown value is invalid.
128+
```
129+
130+
```
131+
CooldownAPI.defaultCooldownLiterals
132+
133+
- description: Default cooldown literals. It literals what replaced cooldowns for any command in game, i.e if you set in config all=10, then all commands be with cooldown 10 sec.
134+
135+
- note: it not override existing cooldown for some command.
136+
```
137+
138+
```
139+
CooldownAPI.addCooldown
140+
141+
- description: Just add new or replace cooldown for target player and for target command.
142+
143+
- accepts:
144+
- nickname - nickname of target player. (string)
145+
- command - target command for cooldown (string)
146+
```
147+
148+
```
149+
CooldownAPI.removeCooldown
150+
151+
- description: Just remove existing cooldown from target player and target command.
152+
153+
- accepts:
154+
- nickname - nickname of target player. (string)
155+
- command - target command for cooldown (string)
156+
```
157+
158+
```
159+
CooldownAPI.getCooldownIsExpired
160+
161+
- accepts:
162+
- nickname - nickname of target player. (string)
163+
- command - target command for cooldown (string)
164+
- minSecondsDuration - minimal seconds diff between old command execute and new command execute. (int)
165+
166+
- return: true if command cooldown expired, else return false. (boolean)
167+
```
168+
169+
```
170+
CooldownAPI.getCooldownTimeLeft
171+
172+
- accepts:
173+
- nickname - nickname of target player. (string)
174+
- command - target command for cooldown (string)
175+
176+
- return: left cooldown time in seconds for command. (double)
177+
```
178+
179+
```
180+
CommandsAliases.aliases
181+
182+
- description: stores all aliases, just add your alias here.
183+
184+
- note: Where `String` - command for aliases; Where `MutableList<String>` - aliases of command.
185+
```
186+
187+
#### 2.3.1 Applying aliases.
188+
189+
When you register your command with aliases, for cooldowns you need register aliases for cooldown api, just make it:
190+
191+
```kotlin
192+
CommandAliases.aliases["mycommand"] = mutableListOf("mcmd", "mycommandalias")
193+
```
194+
195+
### For all questions, be sure to write issues!

0 commit comments

Comments
 (0)