Compare commits

..

No commits in common. "2ea3b6c8612ab15cf66c0071e008d15bf12e1fbe" and "cba9b5f07920c8f378e2d6ba4ec77b5f9942d77f" have entirely different histories.

12 changed files with 37 additions and 126 deletions

7
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "daily"

View file

@ -4,18 +4,6 @@ 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

View file

@ -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.4</version>
<version>1.8.3</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.4</version>
<version>1.8.3</version>
</dependency>
```
@ -185,7 +185,7 @@ repositories {
```kotlin
dependencies {
implementation("cloud.commandframework", "cloud-PLATFORM", "1.8.4")
implementation("cloud.commandframework", "cloud-PLATFORM", "1.8.3")
}
```

View file

@ -41,6 +41,7 @@ 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;
@ -612,6 +613,10 @@ 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++) {
@ -631,7 +636,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) {
} else if (commandQueue.size() == 1 && commandQueue.peek().isEmpty()) {
return this.directSuggestions(commandContext, child, commandQueue.peek());
}

View file

@ -23,7 +23,6 @@
//
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;
@ -38,10 +37,8 @@ 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;
@ -638,41 +635,6 @@ 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);
}

View file

@ -24,14 +24,14 @@ mappings will be available.
<dependency>
<groupId>cloud.commandframework</groupId>
<artifactId>cloud-bukkit</artifactId>
<version>1.8.4</version>
<version>1.8.3</version>
</dependency>
```
**gradle**:
```groovy
dependencies {
implementation 'cloud.commandframework:cloud-bukkit:1.8.4'
implementation 'cloud.commandframework:cloud-bukkit:1.8.3'
}
```
@ -93,14 +93,14 @@ mappings are available even without commodore present.
<dependency>
<groupId>cloud.commandframework</groupId>
<artifactId>cloud-paper</artifactId>
<version>1.8.4</version>
<version>1.8.3</version>
</dependency>
```
**gradle**:
```groovy
dependencies {
implementation 'cloud.commandframework:cloud-paper:1.8.4'
implementation 'cloud.commandframework:cloud-paper:1.8.3'
}
```
@ -118,14 +118,14 @@ BungeeCord mappings for cloud.
<dependency>
<groupId>cloud.commandframework</groupId>
<artifactId>cloud-bungee</artifactId>
<version>1.8.4</version>
<version>1.8.3</version>
</dependency>
```
**gradle**:
```groovy
dependencies {
implementation 'cloud.commandframework:cloud-bungee:1.8.4'
implementation 'cloud.commandframework:cloud-bungee:1.8.3'
}
```
@ -150,14 +150,14 @@ cloud mappings for Velocity 1.1.0.
<dependency>
<groupId>cloud.commandframework</groupId>
<artifactId>cloud-velocity</artifactId>
<version>1.8.4</version>
<version>1.8.3</version>
</dependency>
```
**gradle**:
```groovy
dependencies {
implementation 'cloud.commandframework:cloud-velocity:1.8.4'
implementation 'cloud.commandframework:cloud-velocity:1.8.3'
}
```
@ -181,14 +181,14 @@ cloud mappings for CloudBurst 1.0.0-SNAPSHOT.
<dependency>
<groupId>cloud.commandframework</groupId>
<artifactId>cloud-cloudburst</artifactId>
<version>1.8.4</version>
<version>1.8.3</version>
</dependency>
```
**gradle**:
```groovy
dependencies {
implementation 'cloud.commandframework:cloud-velocity:1.8.4'
implementation 'cloud.commandframework:cloud-velocity:1.8.3'
}
```
@ -217,7 +217,7 @@ the latest release of cloud.
**gradle**:
```groovy
dependencies {
modImplementation 'cloud.commandframework:cloud-fabric:1.8.4'
modImplementation 'cloud.commandframework:cloud-fabric:1.8.3'
}
```

View file

@ -55,25 +55,20 @@ public final class CraftBukkitReflection {
final String pkg = serverClass.getPackage().getName();
final String nmsVersion = pkg.substring(pkg.lastIndexOf(".") + 1);
if (!nmsVersion.contains("_")) {
int fallbackVersion;
int fallbackVersion = -1;
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

View file

@ -53,7 +53,6 @@ public final class RegistryReflection {
);
private static final Constructor<?> RESOURCE_LOCATION_CTR = CraftBukkitReflection.needConstructor(
RESOURCE_LOCATION_CLASS,
String.class,
String.class
);
@ -61,8 +60,6 @@ public final class RegistryReflection {
}
static {
RESOURCE_LOCATION_CTR.setAccessible(true);
Class<?> registryClass;
if (CraftBukkitReflection.MAJOR_REVISION < 17) {
REGISTRY_REGISTRY = null;
@ -125,11 +122,7 @@ public final class RegistryReflection {
public static Object createResourceLocation(final String str) {
try {
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]);
return RESOURCE_LOCATION_CTR.newInstance(str);
} catch (final ReflectiveOperationException e) {
throw new RuntimeException(e);
}

View file

@ -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.getCause()
throwable
);
}
);

View file

@ -1,5 +1,5 @@
group=org.zhdev.oblak
version=1.8.5-SNAPSHOT
group=cloud.commandframework
version=1.8.4-SNAPSHOT
description=Command framework and dispatcher for the JVM
org.gradle.caching=true

View file

@ -1,39 +0,0 @@
{
"$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): "
}

View file

@ -74,7 +74,7 @@ dependencyResolutionManagement {
}
}
rootProject.name = "oblak"
rootProject.name = "cloud"
include(":cloud-bom")