From 544c344f18b15d2e9e64adf57ce066fe53c1fdf0 Mon Sep 17 00:00:00 2001 From: jmp Date: Mon, 30 Nov 2020 16:41:06 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9A=20Update=20changelog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also minor codestyle fixes --- CHANGELOG.md | 1 + .../main/java/cloud/commandframework/CommandTree.java | 6 +++--- .../minecraft/extras/ComponentHelper.java | 11 ++++------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 457e2d5c..3f647a85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Use the correct default range for Double and Float parsers in the StandardParserRegistry - Fix Bukkit alias command suggestions without Brigadier - Fix Bukkit command alias registration when using Brigadier + - Fixed a bug where providing valid input for an argument caused cloud to no longer make suggestions ## [1.1.0] - 2020-10-24 diff --git a/cloud-core/src/main/java/cloud/commandframework/CommandTree.java b/cloud-core/src/main/java/cloud/commandframework/CommandTree.java index debeca33..a2e7651a 100644 --- a/cloud-core/src/main/java/cloud/commandframework/CommandTree.java +++ b/cloud-core/src/main/java/cloud/commandframework/CommandTree.java @@ -493,10 +493,10 @@ public final class CommandTree { } } - private @NonNull List suggestionsForDynamicArgument( + private @NonNull List<@NonNull String> suggestionsForDynamicArgument( final @NonNull CommandContext commandContext, final @NonNull Queue<@NonNull String> commandQueue, - final @NonNull Node> child + final @NonNull Node<@Nullable CommandArgument> child ) { /* When we get in here, we need to treat compound arguments a little differently */ if (child.getValue() instanceof CompoundArgument) { @@ -552,7 +552,7 @@ public final class CommandTree { } // Store original input command queue before the parsers below modify it - final Queue commandQueueOriginal = new LinkedList(commandQueue); + final Queue commandQueueOriginal = new LinkedList<>(commandQueue); // START: Preprocessing final ArgumentParseResult preParseResult = child.getValue().preprocess( diff --git a/cloud-minecraft/cloud-minecraft-extras/src/main/java/cloud/commandframework/minecraft/extras/ComponentHelper.java b/cloud-minecraft/cloud-minecraft-extras/src/main/java/cloud/commandframework/minecraft/extras/ComponentHelper.java index 5ff3be05..8b43336e 100644 --- a/cloud-minecraft/cloud-minecraft-extras/src/main/java/cloud/commandframework/minecraft/extras/ComponentHelper.java +++ b/cloud-minecraft/cloud-minecraft-extras/src/main/java/cloud/commandframework/minecraft/extras/ComponentHelper.java @@ -25,7 +25,6 @@ package cloud.commandframework.minecraft.extras; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; -import net.kyori.adventure.text.TextReplacementConfig; import net.kyori.adventure.text.format.TextColor; import org.checkerframework.checker.nullness.qual.NonNull; @@ -42,12 +41,10 @@ final class ComponentHelper { final @NonNull Component component, final @NonNull TextColor highlightColor ) { - return component.replaceText( - TextReplacementConfig.builder() - .match(SPECIAL_CHARACTERS_PATTERN) - .replacement(match -> match.color(highlightColor)) - .build() - ); + return component.replaceText(config -> { + config.match(SPECIAL_CHARACTERS_PATTERN); + config.replacement(match -> match.color(highlightColor)); + }); } public static @NonNull Component repeat(