Compare commits
10 commits
cba9b5f079
...
2ea3b6c861
| Author | SHA1 | Date | |
|---|---|---|---|
| 2ea3b6c861 | |||
| c94a032bea | |||
| 70a56e345c | |||
| 4ffda18a48 | |||
|
|
980ba0dfb3 | ||
|
|
30c3094d8a | ||
|
|
0d617f26bb | ||
|
|
fda52448c2 | ||
|
|
19bbfb1e24 | ||
|
|
90b63e53f3 |
12 changed files with 126 additions and 37 deletions
7
.github/dependabot.yml
vendored
7
.github/dependabot.yml
vendored
|
|
@ -1,7 +0,0 @@
|
|||
version: 2
|
||||
|
||||
updates:
|
||||
- package-ecosystem: "gradle"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
12
CHANGELOG.md
12
CHANGELOG.md
|
|
@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [1.8.4]
|
||||
|
||||
### Fixed
|
||||
- Core: Flags not tab-completing unless string is empty ([#460](https://github.com/Incendo/cloud/pull/460))
|
||||
- Core: Parser registry not properly resolving `TypeToken`s ([#454](https://github.com/Incendo/cloud/pull/454))
|
||||
- Fabric: Pottery pattern registry overriding default string parser for annotations
|
||||
- Fabric: Log cause of CommandExecutionException in fabric's default exception handler ([#466](https://github.com/Incendo/cloud/pull/466))
|
||||
|
||||
### Changed
|
||||
- Core: Improved string parser supplier argument checking
|
||||
- Bukkit/Paper: Improve docs around Brigadier support
|
||||
|
||||
## [1.8.3]
|
||||
|
||||
### Changed
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ Snapshot builds of Cloud are available through the [Sonatype OSS Snapshot reposi
|
|||
<dependency>
|
||||
<groupId>cloud.commandframework</groupId>
|
||||
<artifactId>cloud-PLATFORM</artifactId>
|
||||
<version>1.8.3</version>
|
||||
<version>1.8.4</version>
|
||||
</dependency>
|
||||
<!--
|
||||
~ Optional: Allows you to use annotated methods
|
||||
|
|
@ -124,7 +124,7 @@ Snapshot builds of Cloud are available through the [Sonatype OSS Snapshot reposi
|
|||
<dependency>
|
||||
<groupId>cloud.commandframework</groupId>
|
||||
<artifactId>cloud-annotations</artifactId>
|
||||
<version>1.8.3</version>
|
||||
<version>1.8.4</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ repositories {
|
|||
|
||||
```kotlin
|
||||
dependencies {
|
||||
implementation("cloud.commandframework", "cloud-PLATFORM", "1.8.3")
|
||||
implementation("cloud.commandframework", "cloud-PLATFORM", "1.8.4")
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ import cloud.commandframework.keys.SimpleCloudKey;
|
|||
import cloud.commandframework.permission.CommandPermission;
|
||||
import cloud.commandframework.permission.OrPermission;
|
||||
import cloud.commandframework.types.tuples.Pair;
|
||||
import io.leangen.geantyref.GenericTypeReflector;
|
||||
import io.leangen.geantyref.TypeToken;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
|
@ -613,10 +612,6 @@ public final class CommandTree<C> {
|
|||
if (!lastFlag.isPresent()) {
|
||||
commandContext.remove(FlagArgument.FLAG_META_KEY);
|
||||
}
|
||||
} else if (GenericTypeReflector.erase(child.getValue().getValueType().getType()).isArray()) {
|
||||
while (commandQueue.size() > 1) {
|
||||
commandQueue.remove();
|
||||
}
|
||||
} else if (commandQueue.size() <= child.getValue().getParser().getRequestedArgumentCount()) {
|
||||
for (int i = 0; i < child.getValue().getParser().getRequestedArgumentCount() - 1
|
||||
&& commandQueue.size() > 1; i++) {
|
||||
|
|
@ -636,7 +631,7 @@ public final class CommandTree<C> {
|
|||
} else if (child.getValue() instanceof CompoundArgument) {
|
||||
return this.directSuggestions(commandContext, child, ((LinkedList<String>) commandQueue).getLast());
|
||||
}
|
||||
} else if (commandQueue.size() == 1 && commandQueue.peek().isEmpty()) {
|
||||
} else if (commandQueue.size() == 1) {
|
||||
return this.directSuggestions(commandContext, child, commandQueue.peek());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
//
|
||||
package cloud.commandframework;
|
||||
|
||||
import cloud.commandframework.arguments.CommandArgument;
|
||||
import cloud.commandframework.arguments.compound.ArgumentTriplet;
|
||||
import cloud.commandframework.arguments.parser.ArgumentParseResult;
|
||||
import cloud.commandframework.arguments.standard.BooleanArgument;
|
||||
|
|
@ -37,8 +38,10 @@ import cloud.commandframework.types.tuples.Triplet;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static cloud.commandframework.util.TestUtils.createManager;
|
||||
|
|
@ -635,6 +638,41 @@ public class CommandSuggestionsTest {
|
|||
assertThat(suggestions6).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testTextFlagCompletion() {
|
||||
// Arrange
|
||||
final CommandManager<TestCommandSender> manager = createManager();
|
||||
manager.setSetting(CommandManager.ManagerSettings.LIBERAL_FLAG_PARSING, true);
|
||||
manager.command(
|
||||
manager.commandBuilder("command")
|
||||
.flag(manager.flagBuilder("flag").withAliases("f")
|
||||
.withArgument(EnumArgument.of(TestEnum.class, "test")).build())
|
||||
.flag(manager.flagBuilder("flog").build())
|
||||
);
|
||||
|
||||
// Act
|
||||
final List<String> suggestions1 = suggest(manager, "command ");
|
||||
final List<String> suggestions2 = suggest(manager, "command --");
|
||||
final List<String> suggestions3 = suggest(manager, "command --f");
|
||||
final List<String> suggestions4 = suggest(manager, "command --fla");
|
||||
final List<String> suggestions5 = suggest(manager, "command -f");
|
||||
final List<String> suggestions6 = suggest(manager, "command -");
|
||||
|
||||
final List<String> suggestions7 = suggest(manager, "command -f ");
|
||||
final List<String> suggestions8 = suggest(manager, "command -f b");
|
||||
|
||||
// Assert
|
||||
assertThat(suggestions1).containsExactly("--flag", "--flog", "-f");
|
||||
assertThat(suggestions2).containsExactly("--flag", "--flog");
|
||||
assertThat(suggestions3).containsExactly("--flag", "--flog");
|
||||
assertThat(suggestions4).containsExactly("--flag");
|
||||
assertThat(suggestions5).containsExactly("-f");
|
||||
assertThat(suggestions6).containsExactly("--flag", "--flog", "-f");
|
||||
assertThat(suggestions7).containsExactly("foo", "bar");
|
||||
assertThat(suggestions8).containsExactly("bar");
|
||||
}
|
||||
|
||||
|
||||
private List<String> suggest(CommandManager<TestCommandSender> manager, String command) {
|
||||
return manager.suggest(new TestCommandSender(), command);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,14 +24,14 @@ mappings will be available.
|
|||
<dependency>
|
||||
<groupId>cloud.commandframework</groupId>
|
||||
<artifactId>cloud-bukkit</artifactId>
|
||||
<version>1.8.3</version>
|
||||
<version>1.8.4</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
**gradle**:
|
||||
```groovy
|
||||
dependencies {
|
||||
implementation 'cloud.commandframework:cloud-bukkit:1.8.3'
|
||||
implementation 'cloud.commandframework:cloud-bukkit:1.8.4'
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -93,14 +93,14 @@ mappings are available even without commodore present.
|
|||
<dependency>
|
||||
<groupId>cloud.commandframework</groupId>
|
||||
<artifactId>cloud-paper</artifactId>
|
||||
<version>1.8.3</version>
|
||||
<version>1.8.4</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
**gradle**:
|
||||
```groovy
|
||||
dependencies {
|
||||
implementation 'cloud.commandframework:cloud-paper:1.8.3'
|
||||
implementation 'cloud.commandframework:cloud-paper:1.8.4'
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -118,14 +118,14 @@ BungeeCord mappings for cloud.
|
|||
<dependency>
|
||||
<groupId>cloud.commandframework</groupId>
|
||||
<artifactId>cloud-bungee</artifactId>
|
||||
<version>1.8.3</version>
|
||||
<version>1.8.4</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
**gradle**:
|
||||
```groovy
|
||||
dependencies {
|
||||
implementation 'cloud.commandframework:cloud-bungee:1.8.3'
|
||||
implementation 'cloud.commandframework:cloud-bungee:1.8.4'
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -150,14 +150,14 @@ cloud mappings for Velocity 1.1.0.
|
|||
<dependency>
|
||||
<groupId>cloud.commandframework</groupId>
|
||||
<artifactId>cloud-velocity</artifactId>
|
||||
<version>1.8.3</version>
|
||||
<version>1.8.4</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
**gradle**:
|
||||
```groovy
|
||||
dependencies {
|
||||
implementation 'cloud.commandframework:cloud-velocity:1.8.3'
|
||||
implementation 'cloud.commandframework:cloud-velocity:1.8.4'
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -181,14 +181,14 @@ cloud mappings for CloudBurst 1.0.0-SNAPSHOT.
|
|||
<dependency>
|
||||
<groupId>cloud.commandframework</groupId>
|
||||
<artifactId>cloud-cloudburst</artifactId>
|
||||
<version>1.8.3</version>
|
||||
<version>1.8.4</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
**gradle**:
|
||||
```groovy
|
||||
dependencies {
|
||||
implementation 'cloud.commandframework:cloud-velocity:1.8.3'
|
||||
implementation 'cloud.commandframework:cloud-velocity:1.8.4'
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -217,7 +217,7 @@ the latest release of cloud.
|
|||
**gradle**:
|
||||
```groovy
|
||||
dependencies {
|
||||
modImplementation 'cloud.commandframework:cloud-fabric:1.8.3'
|
||||
modImplementation 'cloud.commandframework:cloud-fabric:1.8.4'
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -55,20 +55,25 @@ public final class CraftBukkitReflection {
|
|||
final String pkg = serverClass.getPackage().getName();
|
||||
final String nmsVersion = pkg.substring(pkg.lastIndexOf(".") + 1);
|
||||
if (!nmsVersion.contains("_")) {
|
||||
int fallbackVersion = -1;
|
||||
int fallbackVersion;
|
||||
try {
|
||||
final Method getMinecraftVersion = serverClass.getDeclaredMethod("getMinecraftVersion");
|
||||
fallbackVersion = Integer.parseInt(getMinecraftVersion.invoke(Bukkit.getServer()).toString().split("\\.")[1]);
|
||||
} catch (final Exception ignored) {
|
||||
String version = Bukkit.getVersion();
|
||||
version = version.substring(version.indexOf("(MC: ") + 5, version.length() - 1);
|
||||
String[] versionParts = version.split("\\.");
|
||||
fallbackVersion = Integer.parseInt(versionParts[1]);
|
||||
}
|
||||
String name = serverClass.getName();
|
||||
name = name.substring(PREFIX_CRAFTBUKKIT.length());
|
||||
name = name.substring(0, name.length() - CRAFT_SERVER.length());
|
||||
CB_PKG_VERSION = name;
|
||||
MAJOR_REVISION = fallbackVersion;
|
||||
} else {
|
||||
MAJOR_REVISION = Integer.parseInt(nmsVersion.split("_")[1]);
|
||||
CB_PKG_VERSION = "";
|
||||
}
|
||||
String name = serverClass.getName();
|
||||
name = name.substring(PREFIX_CRAFTBUKKIT.length());
|
||||
name = name.substring(0, name.length() - CRAFT_SERVER.length());
|
||||
CB_PKG_VERSION = name;
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ public final class RegistryReflection {
|
|||
);
|
||||
private static final Constructor<?> RESOURCE_LOCATION_CTR = CraftBukkitReflection.needConstructor(
|
||||
RESOURCE_LOCATION_CLASS,
|
||||
String.class,
|
||||
String.class
|
||||
);
|
||||
|
||||
|
|
@ -60,6 +61,8 @@ public final class RegistryReflection {
|
|||
}
|
||||
|
||||
static {
|
||||
RESOURCE_LOCATION_CTR.setAccessible(true);
|
||||
|
||||
Class<?> registryClass;
|
||||
if (CraftBukkitReflection.MAJOR_REVISION < 17) {
|
||||
REGISTRY_REGISTRY = null;
|
||||
|
|
@ -122,7 +125,11 @@ public final class RegistryReflection {
|
|||
|
||||
public static Object createResourceLocation(final String str) {
|
||||
try {
|
||||
return RESOURCE_LOCATION_CTR.newInstance(str);
|
||||
String[] parts = str.split(":", 2);
|
||||
if (parts.length > 1) {
|
||||
return RESOURCE_LOCATION_CTR.newInstance(parts[0], parts[1]);
|
||||
}
|
||||
return RESOURCE_LOCATION_CTR.newInstance("minecraft", parts[0]);
|
||||
} catch (final ReflectiveOperationException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ final class FabricExecutor<C, S extends SharedSuggestionProvider> implements Com
|
|||
LOGGER.warn(
|
||||
"Error occurred while executing command for user {}:",
|
||||
this.getName.apply(source),
|
||||
throwable
|
||||
throwable.getCause()
|
||||
);
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
group=cloud.commandframework
|
||||
version=1.8.4-SNAPSHOT
|
||||
group=org.zhdev.oblak
|
||||
version=1.8.5-SNAPSHOT
|
||||
description=Command framework and dispatcher for the JVM
|
||||
|
||||
org.gradle.caching=true
|
||||
|
|
|
|||
39
renovate.json
Normal file
39
renovate.json
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"config:base"
|
||||
],
|
||||
"baseBranches" : [
|
||||
"/^1.[0-9].[0-9]\\-dev$/"
|
||||
],
|
||||
"ignoreDeps": [
|
||||
"com.mojang:minecraft",
|
||||
"quiet-fabric-loom",
|
||||
"com.google.guava:guava",
|
||||
"com.mojang:brigadier"
|
||||
],
|
||||
"labels": [
|
||||
"dependencies"
|
||||
],
|
||||
"packageRules": [
|
||||
{
|
||||
"description": "Correct version handling for dependencies with format major.minor.patch+mcver",
|
||||
"matchPackageNames": ["net.fabricmc.fabric-api:fabric-api", "net.fabricmc.fabric-api:fabric-api-deprecated"],
|
||||
"versioning": "regex:^(?<major>\\d+)(\\.(?<minor>\\d+))?(\\.(?<patch>\\d+))?(?:\\+(?<compatibility>.*))?$"
|
||||
},
|
||||
{
|
||||
"matchManagers": ["github-actions", "gradle-wrapper"],
|
||||
"groupName": "gradle and github actions"
|
||||
},
|
||||
{
|
||||
"matchDepTypes": ["plugin"],
|
||||
"groupName": "gradle and github actions"
|
||||
},
|
||||
{
|
||||
"matchPaths": ["build-logic/*", "buildSrc/*"],
|
||||
"groupName": "gradle and github actions"
|
||||
}
|
||||
],
|
||||
"semanticCommitType": "build",
|
||||
"commitMessagePrefix": "chore(deps): "
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ dependencyResolutionManagement {
|
|||
}
|
||||
}
|
||||
|
||||
rootProject.name = "cloud"
|
||||
rootProject.name = "oblak"
|
||||
|
||||
include(":cloud-bom")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue