Skip to content

Commit a537d89

Browse files
committed
Bump version
1 parent 55d462f commit a537d89

File tree

2 files changed

+60
-38
lines changed

2 files changed

+60
-38
lines changed

.github/README.md

Lines changed: 57 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ To add this project as a dependency to your project, add the following to your p
3737
<dependency>
3838
<groupId>com.github.Despical</groupId>
3939
<artifactId>CommandFramework</artifactId>
40-
<version>1.5.0</version>
41-
<scope>compile</scope>
40+
<version>1.5.1</version>
4241
</dependency>
4342
```
4443

@@ -50,7 +49,7 @@ repositories {
5049
```
5150
```groovy
5251
dependencies {
53-
implementation 'com.github.Despical:CommandFramework:1.5.0'
52+
implementation 'com.github.Despical:CommandFramework:1.5.1'
5453
}
5554
```
5655

@@ -89,24 +88,24 @@ public class ExampleClass extends JavaPlugin {
8988
// Before creating command the method must only have
9089
// CommandArguments parameter and also @Command annotation
9190
@Command(
92-
name = "example",
93-
aliases = {"firstAlias", "secondAlias"},
94-
permission = "example.permission",
95-
desc = "Sends an example message to sender",
96-
usage = "/example",
97-
min = 1,
98-
max = 5,
99-
onlyOp = false, // this option will ignore permission if it is set
100-
// be careful if you are using non-thread safe operations
101-
// and if you want to enable option below
102-
async = false,
103-
senderType = Command.SenderType.CONSOLE
91+
name = "example",
92+
aliases = {"firstAlias", "secondAlias"},
93+
permission = "example.permission",
94+
desc = "Sends an example message to sender",
95+
usage = "/example",
96+
min = 1,
97+
max = 5,
98+
onlyOp = false, // this option will ignore permission if it is set
99+
// be careful if you are using non-thread safe operations
100+
// and if you want to enable option below
101+
async = false,
102+
senderType = Command.SenderType.CONSOLE
104103
)
105104
@Cooldown(
106-
cooldown = 10,
107-
timeUnit = TimeUnit.SECONDS,
108-
bypassPerm = "command.cooldownBypass",
109-
overrideConsole = true // console will now be affected by cooldown
105+
value = 10,
106+
timeUnit = TimeUnit.SECONDS,
107+
bypassPerm = "command.cooldownBypass",
108+
overrideConsole = true // console will now be affected by cooldown
110109
)
111110
public void exampleCommand(CommandArguments arguments) {
112111
// CommandArguments class contains basic things related Bukkit commands
@@ -115,15 +114,15 @@ public class ExampleClass extends JavaPlugin {
115114
}
116115

117116
@Command(
118-
name = "noParams"
117+
name = "noParams"
119118
)
120119
public void commandWithoutParameters() {
121120
Bukkit.getConsoleSender().sendMessage("This command is running without any parameters.");
122121
}
123122

124123
@Command(
125-
name = "customParamWithoutAnnotations",
126-
min = 1
124+
name = "customParamWithoutAnnotations",
125+
min = 1
127126
)
128127
// See CommandFramework#addCustomParameter method above.
129128
public void customParamCommand(String firstParameter, CommandArguments arguments) {
@@ -132,38 +131,60 @@ public class ExampleClass extends JavaPlugin {
132131
}
133132

134133
@Command(
135-
name = "customParams",
136-
min = 1
134+
name = "customParams",
135+
min = 1
137136
)
138137
// If command is executed with only one argument then the default value will be accepted.
139138
// Otherwise, the given argument will be converted to specified type, in this case an int.
140139
// If parameter is not annotated by @Default then command will throw an exception on execution.
141140
// See the wiki page for creating custom parameters using @Param and @Default annotations.
142141
public void customParamsCommand(CommandArguments arguments,
143-
@Param("secondAsInt")
144-
@Default("50")
145-
int secondArg) {
142+
@Param("secondAsInt")
143+
@Default("50")
144+
int secondArg) {
146145
arguments.sendMessage("Second argument as integer is " + secondArg);
147146
}
148147

149148
@Command(
150-
name = "confirmationTest"
149+
name = "confirmationTest"
151150
)
152151
@Confirmation(
153-
message = "Are you sure, if so, please execute command again to confirm.",
154-
expireAfter = 10,
155-
bypassPerm = "confirmation.bypass",
156-
timeUnit = TimeUnit.SECONDS,
157-
overrideConsole = true
152+
message = "Are you sure, if so, please execute command again to confirm.",
153+
expireAfter = 10,
154+
bypassPerm = "confirmation.bypass",
155+
timeUnit = TimeUnit.SECONDS,
156+
overrideConsole = true
158157
)
159158
public void confirmationCommand(CommandArguments arguments) {
160159
arguments.sendMessage("Confirmation successful.");
161160
}
162161

162+
@Flag(
163+
value = "test",
164+
prefix = "--"
165+
)
166+
@Command(
167+
name = "flag"
168+
)
169+
public void flagTest(CommandArguments arguments) {
170+
arguments.sendMessage("Flag Present: " + arguments.isFlagPresent("test"));
171+
}
172+
173+
@me.despical.commandframework.annotations.Option(
174+
value = "players",
175+
prefix = "--"
176+
)
177+
@Command(
178+
name = "option"
179+
)
180+
public void optionTest(CommandArguments arguments) {
181+
arguments.sendMessage("Parsed Options: " + String.join(", ", arguments.getOption("players")));
182+
}
183+
163184
// Aliases don't need to be same with the command above
164185
@Completer(
165-
name = "example",
166-
aliases = {"firstAlias", "secondAlias"}
186+
name = "example",
187+
aliases = {"firstAlias", "secondAlias"}
167188
)
168189
public List<String> exampleCommandCompletion(/*CommandArguments arguments*/ /*no need to use in this case which is also supported*/) {
169190
return Arrays.asList("first", "second", "third");
@@ -204,4 +225,4 @@ mvn clean package -DskipTests -Dmaven.javadoc.skip=true
204225
```
205226

206227
> [!IMPORTANT]
207-
> **[Maven](https://maven.apache.org/)** must be installed to build Command Framework.
228+
> **[Maven](https://maven.apache.org/)** must be installed to build this project.

pom.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
34
<modelVersion>4.0.0</modelVersion>
45
<groupId>me.despical</groupId>
56
<artifactId>command-framework</artifactId>
6-
<version>1.5.0</version>
7+
<version>1.5.1</version>
78

89
<name>Command Framework</name>
910
<inceptionYear>2020</inceptionYear>

0 commit comments

Comments
 (0)