Skip to content

Commit a90f7c0

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents ce04da1 + 4e5876e commit a90f7c0

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

README.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# CommandAPI
2+
Simple Reflection Command API that just does what you want it to do without any problems.
3+
4+
* Currently not tested, please do not use unless this read me is changed.
5+
6+
### Importing
7+
8+
* Maven
9+
10+
```xml
11+
<repository>
12+
<id>jitpack.io</id>
13+
<url>https://jitpack.io</url>
14+
</repository
15+
```
16+
17+
```xml
18+
<dependency>
19+
<groupId>com.github.therealdamt</groupId>
20+
<artifactId>commandapi</artifactId>
21+
<version>1.0.0</version>
22+
</dependency>
23+
```
24+
25+
* Gradle
26+
27+
```gradle
28+
repositories {
29+
...
30+
maven { url 'https://jitpack.io' }
31+
}
32+
```
33+
34+
```gradle
35+
dependencies {
36+
implementation 'com.github.therealdamt:commandapi:Tag'
37+
}
38+
```
39+
40+
### How to use
41+
42+
* Example main class
43+
44+
```java
45+
public class Main extends JavaPlugin {
46+
47+
@Getter
48+
private static Main instance;
49+
50+
private CommandHandler commandHandler;
51+
52+
@Override
53+
public void onLoad() {
54+
instance = this;
55+
}
56+
57+
@Override
58+
public void onEnable() {
59+
this.commandHandler = new CommandHandler(this);
60+
commandHandler.register(new FlyCommand());
61+
commandHandler.registerCommands();
62+
}
63+
64+
}
65+
```
66+
67+
* Example command class
68+
69+
```java
70+
public class FlyCommand {
71+
72+
/**
73+
* So this is a simple command example
74+
* There are 2 rules to every command:
75+
* <p>
76+
* 1- Must have a sender could be a player or a command sender
77+
* 2- Must have an array of strings
78+
*
79+
* @param player sender
80+
* @param args arguments to execute with
81+
*/
82+
83+
@Command(value = "fly", description = "Fly Command", usage = "fly")
84+
@Permission(permission = "command.fly", message = "You may not use this command!")
85+
public void flyCommand(@Sender Player player, String[] args) {
86+
player.setAllowFlight(!player.getAllowFlight());
87+
88+
String isFlying = player.getAllowFlight() ? "&aenabled" : "&cdisabled";
89+
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&aYour flying is now " + isFlying));
90+
}
91+
92+
}
93+
```
94+
95+
### Credits
96+
97+
You have full rights to use this command api within your projects, but if possible to include credits that'd be amazing!
98+
99+
### Contact
100+
101+
* [Telegram](https://t.me/therealdamt)
102+
* [Website](https://damt.xyz)
103+
* Discord | damt#0886

0 commit comments

Comments
 (0)