Skip to content
This repository was archived by the owner on Oct 2, 2024. It is now read-only.

Commit f8a2bbb

Browse files
committed
Add parameters compile flag section.
1 parent 7071363 commit f8a2bbb

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

Writerside/litecommands.tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<toc-element topic="IntelliJ-IDEA-Plugin.md"/>
1414
<toc-element toc-title="Getting Started">
1515
<toc-element topic="Dependency.md"/>
16+
<toc-element topic="Parameters-compile-flag.md"/>
1617
</toc-element>
1718
<toc-element topic="Platforms.md">
1819
<toc-element topic="SENDER.md"/>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Parameters compile flag
2+
3+
Add `-parameters` flag to your compiler to use all features of LiteCommands:
4+
Depending on the build system you are using, add the following code to your project:
5+
6+
<tabs group="languages">
7+
<tab title="Gradle KTS" group-key="gradle">
8+
9+
Add the following line to your `build.gradle.kts` file:
10+
<br/><br/>
11+
12+
```kotlin
13+
tasks.withType<JavaCompile> {
14+
options.compilerArgs.add("-parameters")
15+
}
16+
```
17+
</tab>
18+
19+
<tab title="Gradle Groovy" group-key="groovy">
20+
21+
Add the following line to your `build.gradle` file:
22+
<br/><br/>
23+
24+
```kotlin
25+
tasks.withType(JavaCompile) {
26+
options.compilerArgs << "-parameters"
27+
}
28+
```
29+
</tab>
30+
31+
<tab title="Maven" group-key="maven">
32+
33+
Add the following lines to your `pom.xml` file in the `plugins` section:
34+
<br/><br/>
35+
36+
```xml
37+
<plugin>
38+
<groupId>org.apache.maven.plugins</groupId>
39+
<artifactId>maven-compiler-plugin</artifactId>
40+
<version>3.11.0</version>
41+
<configuration>
42+
<compilerArgs>
43+
<arg>-parameters</arg>
44+
</compilerArgs>
45+
</configuration>
46+
</plugin>
47+
```
48+
</tab>
49+
</tabs>
50+
51+
<tip>
52+
Parameters are used to get the name of the parameter in the method.
53+
Without this flag, the name of the command arguments will be <code>arg0</code>, <code>arg1</code>, etc.
54+
55+
Also you can define the name of the parameter in the <code>@Arg("name")</code> annotation.
56+
</tip>

0 commit comments

Comments
 (0)