Skip to content

Commit 4f4097c

Browse files
committed
Multilevel argument suggestion critical fix and 2.3.2 Release
1 parent dc5d620 commit 4f4097c

File tree

9 files changed

+38
-16
lines changed

9 files changed

+38
-16
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Helpful links:
55
- [Support Discord](https://discord.gg/6cUhkj6uZJ)
66
- [GitHub issues](https://github.com/Rollczi/LiteCommands/issues)
7-
- [Example (Modern 2.3.1)](https://github.com/Rollczi/LiteCommands/tree/master/examples/bukkit)
7+
- [Example (Modern 2.3.2)](https://github.com/Rollczi/LiteCommands/tree/master/examples/bukkit)
88
- [Docs (Legacy 1.7.2)](https://docs.rollczi.dev/)
99

1010
### Panda Repository (Maven or Gradle) ❤️
@@ -23,11 +23,11 @@ Framework Core
2323
<dependency>
2424
<groupId>dev.rollczi.litecommands</groupId>
2525
<artifactId>core</artifactId>
26-
<version>2.3.1</version>
26+
<version>2.3.2</version>
2727
</dependency>
2828
```
2929
```groovy
30-
implementation 'dev.rollczi.litecommands:core:2.3.1'
30+
implementation 'dev.rollczi.litecommands:core:2.3.2'
3131
```
3232

3333
### First Simple Command
@@ -57,11 +57,11 @@ Add this to your dependencies if you want use ready-made implementation for velo
5757
<dependency>
5858
<groupId>dev.rollczi.litecommands</groupId>
5959
<artifactId>velocity</artifactId>
60-
<version>2.3.1</version>
60+
<version>2.3.2</version>
6161
</dependency>
6262
```
6363
```groovy
64-
implementation 'dev.rollczi.litecommands:velocity:2.3.1'
64+
implementation 'dev.rollczi.litecommands:velocity:2.3.2'
6565
```
6666

6767
#### All extensions:

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ plugins {
1414

1515
allprojects {
1616
group = "dev.rollczi.litecommands"
17-
version = "2.3.1"
17+
version = "2.3.2"
1818

1919
apply(plugin = "java-library")
2020
apply(plugin = "maven-publish")

examples/bukkit/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repositories {
1010

1111
dependencies {
1212
compileOnly("org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT")
13-
// implementation("dev.rollczi.litecommands:bukkit:2.3.1") // <-- uncomment in your project
13+
// implementation("dev.rollczi.litecommands:bukkit:2.3.2") // <-- uncomment in your project
1414
implementation(project(":litecommands-bukkit")) // don't use this line in your build.gradle
1515

1616
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.1")

litecommands-bukkit-adventure/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ Maven
44
<dependency>
55
<groupId>dev.rollczi.litecommands</groupId>
66
<artifactId>bukkit-adventure</artifactId>
7-
<version>2.3.1</version>
7+
<version>2.3.2</version>
88
</dependency>
99
```
1010
Gradle
1111
```groovy
12-
implementation 'dev.rollczi.litecommands:bukkit-adventure:2.3.1'
12+
implementation 'dev.rollczi.litecommands:bukkit-adventure:2.3.2'
1313
```

litecommands-bukkit/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ Maven
44
<dependency>
55
<groupId>dev.rollczi.litecommands</groupId>
66
<artifactId>bukkit</artifactId>
7-
<version>2.3.1</version>
7+
<version>2.3.2</version>
88
</dependency>
99
```
1010
Gradle
1111
```groovy
12-
implementation 'dev.rollczi.litecommands:bukkit:2.3.1'
12+
implementation 'dev.rollczi.litecommands:bukkit:2.3.2'
1313
```
1414

1515
#### Examples:

litecommands-bungee/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ Maven
44
<dependency>
55
<groupId>dev.rollczi.litecommands</groupId>
66
<artifactId>bungee</artifactId>
7-
<version>2.3.1</version>
7+
<version>2.3.2</version>
88
</dependency>
99
```
1010
Gradle
1111
```groovy
12-
implementation 'dev.rollczi.litecommands:bungee:2.3.1'
12+
implementation 'dev.rollczi.litecommands:bungee:2.3.2'
1313
```
1414

1515
#### Examples:

litecommands-core/src/main/java/dev/rollczi/litecommands/suggestion/Suggester.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ default boolean validate(Suggestion suggestion) {
1616
default SuggesterResult extractSuggestions(int route, LiteInvocation invocation) {
1717
String[] rawArguments = invocation.arguments();
1818
UniformSuggestionStack stack = this.suggestion();
19-
List<String> multilevelArguments = Arrays.asList(rawArguments).subList(route, Math.min(route + stack.lengthMultilevel(), rawArguments.length));
19+
int end = Math.min(route + stack.lengthMultilevel(), rawArguments.length);
20+
21+
if (route > end) {
22+
return new SuggesterResult(stack, true);
23+
}
24+
25+
List<String> multilevelArguments = Arrays.asList(rawArguments).subList(route, end);
2026

2127
if (multilevelArguments.isEmpty()) {
2228
return new SuggesterResult(stack, true);

litecommands-core/src/test/java/dev/rollczi/litecommands/command/sugesttion/SuggestionTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,22 @@ void multilevelOneArgumentTest() {
188188

189189
@Test
190190
void allArgumentsMultilevelTest() {
191+
List<String> suggestion = testPlatform.suggestion("teleport", "100", "100", "100");
192+
193+
assertEquals(1, suggestion.size());
194+
assertEquals("100", suggestion.get(0));
195+
}
196+
197+
@Test
198+
void allArgumentsMultilevelTest2() {
199+
List<String> suggestion = testPlatform.suggestion("teleport", "100", "");
200+
201+
assertEquals(1, suggestion.size());
202+
assertEquals("100 100", suggestion.get(0));
203+
}
204+
205+
@Test
206+
void allArgumentsMultilevelWithNextTest() {
191207
List<String> suggestion = testPlatform.suggestion("teleport", "100", "100", "100", "");
192208

193209
assertEquals(1, suggestion.size());

litecommands-velocity/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ Maven
44
<dependency>
55
<groupId>dev.rollczi.litecommands</groupId>
66
<artifactId>velocity</artifactId>
7-
<version>2.3.1</version>
7+
<version>2.3.2</version>
88
</dependency>
99
```
1010
Gradle
1111
```groovy
12-
implementation 'dev.rollczi.litecommands:velocity:2.3.1'
12+
implementation 'dev.rollczi.litecommands:velocity:2.3.2'
1313
```
1414

1515
#### Examples:

0 commit comments

Comments
 (0)