From b238e9a580ccbb5fefd9f715bad3c08e59241e6c Mon Sep 17 00:00:00 2001 From: Octavia Togami Date: Tue, 11 Aug 2020 00:48:25 -0700 Subject: [PATCH 1/7] Move to Adventure --- buildSrc/src/main/kotlin/Libs.kt | 6 +++--- .../piston/gen/util/CodeBlockUtil.java | 4 ++-- .../org/enginehub/piston/RegressionTest.kt | 2 +- .../org/enginehub/piston/TestSupport.kt | 4 ++-- .../suggestion/ManagerSuggestionTest.kt | 2 +- .../suggestion/SimpleSuggestingConverter.kt | 4 ++-- .../piston/util/HelpGeneratorTest.kt | 4 ++-- .../gen/CollectionArgRegistration.java | 4 ++-- .../gen/CommandValueArgRegistration.java | 4 ++-- .../test/resources/gen/FlagsRegistration.java | 6 +++--- .../resources/gen/IntArgRegistration.java | 4 ++-- .../test/resources/gen/NoArgRegistration.java | 2 +- .../gen/NonArgParametersRegistration.java | 4 ++-- .../gen/Outer_BasicNestedRegistration.java | 2 +- core/build.gradle.kts | 4 ++-- .../java/org/enginehub/piston/Command.java | 2 +- .../enginehub/piston/config/ColorConfig.java | 19 ++++++++++--------- .../org/enginehub/piston/config/Config.java | 4 ++-- .../enginehub/piston/config/ConfigHolder.java | 2 +- .../piston/config/ConfigRenderer.java | 6 +++--- .../enginehub/piston/config/TextConfig.java | 6 +++--- .../piston/converter/ArgumentConverter.java | 2 +- .../ForwardingArgumentConverter.java | 2 +- .../converter/MapArgumentConverter.java | 2 +- .../piston/converter/MultiKeyConverter.java | 2 +- .../converter/SimpleArgumentConverter.java | 4 ++-- .../piston/exception/CommandException.java | 4 ++-- .../exception/ConditionFailedException.java | 2 +- .../exception/ConversionFailedException.java | 4 ++-- .../exception/NoSuchCommandException.java | 2 +- .../piston/exception/NoSuchFlagException.java | 4 ++-- .../exception/StopExecutionException.java | 2 +- .../piston/exception/UsageException.java | 2 +- .../piston/part/ArgAcceptingCommandFlag.java | 6 +++--- .../piston/part/ArgConsumingCommandPart.java | 2 +- .../piston/part/CommandArgument.java | 6 +++--- .../enginehub/piston/part/CommandPart.java | 2 +- .../enginehub/piston/part/CommandParts.java | 4 ++-- .../piston/part/NoArgCommandFlag.java | 4 ++-- .../enginehub/piston/part/SubCommandPart.java | 6 +++--- .../piston/util/ComponentHelper.java | 4 ++-- .../enginehub/piston/util/HelpGenerator.java | 8 ++++---- .../org/enginehub/piston/util/PartHelper.java | 4 ++-- .../org/enginehub/piston/util/TextHelper.java | 8 ++++---- .../piston/config/ConfigHolderTest.java | 10 +++++----- .../piston/exception/ConstructionTest.java | 4 ++-- .../enginehub/piston/impl/CommandImpl.java | 8 +------- .../enginehub/piston/impl/CommandParser.java | 4 ++-- .../piston/impl/CommandManagerTest.java | 4 ++-- 49 files changed, 103 insertions(+), 108 deletions(-) diff --git a/buildSrc/src/main/kotlin/Libs.kt b/buildSrc/src/main/kotlin/Libs.kt index abf3688..06c9648 100644 --- a/buildSrc/src/main/kotlin/Libs.kt +++ b/buildSrc/src/main/kotlin/Libs.kt @@ -4,9 +4,9 @@ object Libs { const val junitEngine = "org.junit.jupiter:junit-jupiter-engine:$junitVersion" const val junitVintageEngine = "org.junit.vintage:junit-vintage-engine:$junitVersion" const val guava = "com.google.guava:guava" - private const val kyoriTextVersion = "3.0.4" - const val kyoriText = "net.kyori:text-api:$kyoriTextVersion" - const val kyoriTextPlain = "net.kyori:text-serializer-plain:$kyoriTextVersion" + private const val kyoriAdventureVersion = "4.14.0" + const val kyoriAdventure = "net.kyori:adventure-api:$kyoriAdventureVersion" + const val kyoriAdventureTextPlain = "net.kyori:adventure-text-serializer-plain:$kyoriAdventureVersion" const val autoCommon = "com.google.auto:auto-common:0.11" private const val autoValueVersion = "1.7.4" const val autoValueAnnotations = "com.google.auto.value:auto-value-annotations:$autoValueVersion" diff --git a/core-ap/processor/src/main/java/org/enginehub/piston/gen/util/CodeBlockUtil.java b/core-ap/processor/src/main/java/org/enginehub/piston/gen/util/CodeBlockUtil.java index 883150c..fafec38 100644 --- a/core-ap/processor/src/main/java/org/enginehub/piston/gen/util/CodeBlockUtil.java +++ b/core-ap/processor/src/main/java/org/enginehub/piston/gen/util/CodeBlockUtil.java @@ -22,8 +22,8 @@ import com.google.common.collect.ImmutableList; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.TypeName; -import net.kyori.text.TextComponent; -import net.kyori.text.TranslatableComponent; +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.TranslatableComponent; import org.enginehub.piston.internal.RegistrationUtil; import javax.annotation.Nullable; diff --git a/core-ap/processor/src/test/kotlin/org/enginehub/piston/RegressionTest.kt b/core-ap/processor/src/test/kotlin/org/enginehub/piston/RegressionTest.kt index 5c11e4f..c1f5a35 100644 --- a/core-ap/processor/src/test/kotlin/org/enginehub/piston/RegressionTest.kt +++ b/core-ap/processor/src/test/kotlin/org/enginehub/piston/RegressionTest.kt @@ -19,7 +19,7 @@ package org.enginehub.piston -import net.kyori.text.TextComponent +import net.kyori.adventure.text.TextComponent import org.enginehub.piston.commands.RegressionCommands import org.enginehub.piston.commands.RegressionCommandsRegistration import org.enginehub.piston.converter.SimpleArgumentConverter diff --git a/core-ap/processor/src/test/kotlin/org/enginehub/piston/TestSupport.kt b/core-ap/processor/src/test/kotlin/org/enginehub/piston/TestSupport.kt index bc4ab66..abfecee 100644 --- a/core-ap/processor/src/test/kotlin/org/enginehub/piston/TestSupport.kt +++ b/core-ap/processor/src/test/kotlin/org/enginehub/piston/TestSupport.kt @@ -21,8 +21,8 @@ package org.enginehub.piston import com.google.common.collect.ImmutableList import com.google.common.collect.ImmutableSet -import net.kyori.text.TextComponent -import net.kyori.text.TranslatableComponent +import net.kyori.adventure.text.TextComponent +import net.kyori.adventure.text.TranslatableComponent import org.enginehub.piston.gen.CommandRegistration import org.enginehub.piston.part.ArgAcceptingCommandFlag import org.enginehub.piston.part.CommandArgument diff --git a/core-ap/processor/src/test/kotlin/org/enginehub/piston/suggestion/ManagerSuggestionTest.kt b/core-ap/processor/src/test/kotlin/org/enginehub/piston/suggestion/ManagerSuggestionTest.kt index f6ef715..0b116c4 100644 --- a/core-ap/processor/src/test/kotlin/org/enginehub/piston/suggestion/ManagerSuggestionTest.kt +++ b/core-ap/processor/src/test/kotlin/org/enginehub/piston/suggestion/ManagerSuggestionTest.kt @@ -19,7 +19,7 @@ package org.enginehub.piston.suggestion -import net.kyori.text.TextComponent +import net.kyori.adventure.text.TextComponent import org.enginehub.piston.Command import org.enginehub.piston.CommandManager import org.enginehub.piston.assertEqualUnordered diff --git a/core-ap/processor/src/test/kotlin/org/enginehub/piston/suggestion/SimpleSuggestingConverter.kt b/core-ap/processor/src/test/kotlin/org/enginehub/piston/suggestion/SimpleSuggestingConverter.kt index a0a8dd1..d005dbc 100644 --- a/core-ap/processor/src/test/kotlin/org/enginehub/piston/suggestion/SimpleSuggestingConverter.kt +++ b/core-ap/processor/src/test/kotlin/org/enginehub/piston/suggestion/SimpleSuggestingConverter.kt @@ -19,8 +19,8 @@ package org.enginehub.piston.suggestion -import net.kyori.text.Component -import net.kyori.text.TextComponent +import net.kyori.adventure.text.Component +import net.kyori.adventure.text.TextComponent import org.enginehub.piston.converter.ArgumentConverter import org.enginehub.piston.converter.ConversionResult import org.enginehub.piston.converter.FailedConversion diff --git a/core-ap/processor/src/test/kotlin/org/enginehub/piston/util/HelpGeneratorTest.kt b/core-ap/processor/src/test/kotlin/org/enginehub/piston/util/HelpGeneratorTest.kt index c2fd987..f37857f 100644 --- a/core-ap/processor/src/test/kotlin/org/enginehub/piston/util/HelpGeneratorTest.kt +++ b/core-ap/processor/src/test/kotlin/org/enginehub/piston/util/HelpGeneratorTest.kt @@ -20,7 +20,7 @@ package org.enginehub.piston.util import com.google.common.collect.ImmutableList -import net.kyori.text.TextComponent +import net.kyori.adventure.text.TextComponent import org.enginehub.piston.TestCommandMetadata import org.enginehub.piston.TestCommandParameters import org.enginehub.piston.TestParseResult @@ -180,4 +180,4 @@ class HelpGeneratorTest { ).fullName)) } -} \ No newline at end of file +} diff --git a/core-ap/processor/src/test/resources/gen/CollectionArgRegistration.java b/core-ap/processor/src/test/resources/gen/CollectionArgRegistration.java index 32014ae..e4a2d90 100644 --- a/core-ap/processor/src/test/resources/gen/CollectionArgRegistration.java +++ b/core-ap/processor/src/test/resources/gen/CollectionArgRegistration.java @@ -34,8 +34,8 @@ import java.lang.Throwable; import java.lang.reflect.Method; import java.util.Collection; -import net.kyori.text.TextComponent; -import net.kyori.text.TranslatableComponent; +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.TranslatableComponent; import org.enginehub.piston.CommandManager; import org.enginehub.piston.CommandParameters; import org.enginehub.piston.gen.CommandCallListener; diff --git a/core-ap/processor/src/test/resources/gen/CommandValueArgRegistration.java b/core-ap/processor/src/test/resources/gen/CommandValueArgRegistration.java index ae759a1..7d39cf9 100644 --- a/core-ap/processor/src/test/resources/gen/CommandValueArgRegistration.java +++ b/core-ap/processor/src/test/resources/gen/CommandValueArgRegistration.java @@ -32,8 +32,8 @@ import java.lang.Throwable; import java.lang.reflect.Method; import java.util.Collection; -import net.kyori.text.TextComponent; -import net.kyori.text.TranslatableComponent; +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.TranslatableComponent; import org.enginehub.piston.CommandManager; import org.enginehub.piston.CommandParameters; import org.enginehub.piston.CommandValue; diff --git a/core-ap/processor/src/test/resources/gen/FlagsRegistration.java b/core-ap/processor/src/test/resources/gen/FlagsRegistration.java index bea4230..d0dcaf9 100644 --- a/core-ap/processor/src/test/resources/gen/FlagsRegistration.java +++ b/core-ap/processor/src/test/resources/gen/FlagsRegistration.java @@ -32,8 +32,8 @@ import java.lang.Throwable; import java.lang.reflect.Method; import java.util.Collection; -import net.kyori.text.TextComponent; -import net.kyori.text.TranslatableComponent; +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.TranslatableComponent; import org.enginehub.piston.CommandManager; import org.enginehub.piston.CommandParameters; import org.enginehub.piston.gen.CommandCallListener; @@ -166,4 +166,4 @@ public void build() { private String extract$flag3(CommandParameters parameters) { return flagPart3.value(parameters).asSingle(string_Key); } -} \ No newline at end of file +} diff --git a/core-ap/processor/src/test/resources/gen/IntArgRegistration.java b/core-ap/processor/src/test/resources/gen/IntArgRegistration.java index e1b247d..c99123c 100644 --- a/core-ap/processor/src/test/resources/gen/IntArgRegistration.java +++ b/core-ap/processor/src/test/resources/gen/IntArgRegistration.java @@ -37,8 +37,8 @@ import java.lang.reflect.Method; import java.util.Collection; import java.util.List; -import net.kyori.text.TextComponent; -import net.kyori.text.TranslatableComponent; +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.TranslatableComponent; import org.enginehub.piston.CommandManager; import org.enginehub.piston.CommandParameters; import org.enginehub.piston.gen.CommandCallListener; diff --git a/core-ap/processor/src/test/resources/gen/NoArgRegistration.java b/core-ap/processor/src/test/resources/gen/NoArgRegistration.java index c2d8ea8..f404237 100644 --- a/core-ap/processor/src/test/resources/gen/NoArgRegistration.java +++ b/core-ap/processor/src/test/resources/gen/NoArgRegistration.java @@ -32,7 +32,7 @@ import java.lang.Throwable; import java.lang.reflect.Method; import java.util.Collection; -import net.kyori.text.TextComponent; +import net.kyori.adventure.text.TextComponent; import org.enginehub.piston.Command; import org.enginehub.piston.CommandManager; import org.enginehub.piston.CommandParameters; diff --git a/core-ap/processor/src/test/resources/gen/NonArgParametersRegistration.java b/core-ap/processor/src/test/resources/gen/NonArgParametersRegistration.java index 44674f6..f26ac12 100644 --- a/core-ap/processor/src/test/resources/gen/NonArgParametersRegistration.java +++ b/core-ap/processor/src/test/resources/gen/NonArgParametersRegistration.java @@ -34,7 +34,7 @@ import java.lang.reflect.Method; import java.util.Collection; import java.util.concurrent.Callable; -import net.kyori.text.TextComponent; +import net.kyori.adventure.text.TextComponent; import org.enginehub.piston.CommandManager; import org.enginehub.piston.CommandParameters; import org.enginehub.piston.gen.CommandCallListener; @@ -126,4 +126,4 @@ public void build() { private Callable extract$injected(CommandParameters parameters) { return requireOptional(callable$Object_Key, "injected", parameters.injectedValue(callable$Object_Key)); } -} \ No newline at end of file +} diff --git a/core-ap/processor/src/test/resources/gen/Outer_BasicNestedRegistration.java b/core-ap/processor/src/test/resources/gen/Outer_BasicNestedRegistration.java index 2dcfc6b..fcf228e 100644 --- a/core-ap/processor/src/test/resources/gen/Outer_BasicNestedRegistration.java +++ b/core-ap/processor/src/test/resources/gen/Outer_BasicNestedRegistration.java @@ -32,7 +32,7 @@ import java.lang.Throwable; import java.lang.reflect.Method; import java.util.Collection; -import net.kyori.text.TextComponent; +import net.kyori.adventure.text.TextComponent; import org.enginehub.piston.CommandManager; import org.enginehub.piston.CommandParameters; import org.enginehub.piston.gen.CommandCallListener; diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 3609940..d688eea 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -2,9 +2,9 @@ applyCommonConfig() dependencies { "api"(Libs.guava) - "api"(Libs.kyoriText) + "api"(Libs.kyoriAdventure) "api"(Libs.javaxAnnotations) - "implementation"(Libs.kyoriTextPlain) + "implementation"(Libs.kyoriAdventureTextPlain) "compileOnly"(Libs.autoValueAnnotations) "annotationProcessor"(Libs.autoValueProcessor) "testImplementation"(Libs.mockito) diff --git a/core/src/main/java/org/enginehub/piston/Command.java b/core/src/main/java/org/enginehub/piston/Command.java index 3bbad75..24c4d78 100644 --- a/core/src/main/java/org/enginehub/piston/Command.java +++ b/core/src/main/java/org/enginehub/piston/Command.java @@ -20,7 +20,7 @@ package org.enginehub.piston; import com.google.common.collect.ImmutableList; -import net.kyori.text.Component; +import net.kyori.adventure.text.Component; import org.enginehub.piston.inject.InjectedValueAccess; import org.enginehub.piston.part.CommandPart; import org.enginehub.piston.suggestion.SuggestionProvider; diff --git a/core/src/main/java/org/enginehub/piston/config/ColorConfig.java b/core/src/main/java/org/enginehub/piston/config/ColorConfig.java index 6b33c0e..7623285 100644 --- a/core/src/main/java/org/enginehub/piston/config/ColorConfig.java +++ b/core/src/main/java/org/enginehub/piston/config/ColorConfig.java @@ -20,11 +20,12 @@ package org.enginehub.piston.config; import com.google.common.collect.ImmutableList; -import net.kyori.text.Component; -import net.kyori.text.TextComponent; -import net.kyori.text.TranslatableComponent; -import net.kyori.text.format.Style; -import net.kyori.text.format.TextColor; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.TranslatableComponent; +import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.format.Style; +import net.kyori.adventure.text.format.TextColor; import javax.annotation.Nullable; import java.util.Arrays; @@ -37,13 +38,13 @@ public class ColorConfig extends Config { private static final ColorConfig TEXT_MODIFIER = - new ColorConfig("piston.style.text.modifier", TextColor.YELLOW); + new ColorConfig("piston.style.text.modifier", NamedTextColor.YELLOW); private static final ColorConfig MAIN_TEXT = - new ColorConfig("piston.style.main.text", TextColor.GOLD); + new ColorConfig("piston.style.main.text", NamedTextColor.GOLD); private static final ColorConfig HELP_TEXT = - new ColorConfig("piston.style.help.text", TextColor.GRAY); + new ColorConfig("piston.style.help.text", NamedTextColor.GRAY); private static final ColorConfig PART_WRAPPING = - new ColorConfig("piston.style.part.wrapping", TextColor.YELLOW); + new ColorConfig("piston.style.part.wrapping", NamedTextColor.YELLOW); private static final Set MERGE_NO_COLOR = Style.Merge.of( Style.Merge.DECORATIONS, Style.Merge.INSERTION, Style.Merge.EVENTS diff --git a/core/src/main/java/org/enginehub/piston/config/Config.java b/core/src/main/java/org/enginehub/piston/config/Config.java index 65dd85f..33796e7 100644 --- a/core/src/main/java/org/enginehub/piston/config/Config.java +++ b/core/src/main/java/org/enginehub/piston/config/Config.java @@ -20,8 +20,8 @@ package org.enginehub.piston.config; import com.google.common.collect.ImmutableList; -import net.kyori.text.Component; -import net.kyori.text.TranslatableComponent; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TranslatableComponent; import javax.annotation.Nullable; import java.util.List; diff --git a/core/src/main/java/org/enginehub/piston/config/ConfigHolder.java b/core/src/main/java/org/enginehub/piston/config/ConfigHolder.java index 85e0d00..68577da 100644 --- a/core/src/main/java/org/enginehub/piston/config/ConfigHolder.java +++ b/core/src/main/java/org/enginehub/piston/config/ConfigHolder.java @@ -19,7 +19,7 @@ package org.enginehub.piston.config; -import net.kyori.text.Component; +import net.kyori.adventure.text.Component; import java.util.HashMap; import java.util.Map; diff --git a/core/src/main/java/org/enginehub/piston/config/ConfigRenderer.java b/core/src/main/java/org/enginehub/piston/config/ConfigRenderer.java index 11f4b7f..1c160e6 100644 --- a/core/src/main/java/org/enginehub/piston/config/ConfigRenderer.java +++ b/core/src/main/java/org/enginehub/piston/config/ConfigRenderer.java @@ -20,9 +20,9 @@ package org.enginehub.piston.config; import com.google.common.collect.ImmutableList; -import net.kyori.text.Component; -import net.kyori.text.TranslatableComponent; -import net.kyori.text.renderer.ComponentRenderer; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TranslatableComponent; +import net.kyori.adventure.text.renderer.ComponentRenderer; import org.checkerframework.checker.nullness.qual.NonNull; import java.util.List; diff --git a/core/src/main/java/org/enginehub/piston/config/TextConfig.java b/core/src/main/java/org/enginehub/piston/config/TextConfig.java index 3aa77b0..b7babd1 100644 --- a/core/src/main/java/org/enginehub/piston/config/TextConfig.java +++ b/core/src/main/java/org/enginehub/piston/config/TextConfig.java @@ -19,9 +19,9 @@ package org.enginehub.piston.config; -import net.kyori.text.Component; -import net.kyori.text.TextComponent; -import net.kyori.text.TranslatableComponent; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.TranslatableComponent; import javax.annotation.Nullable; diff --git a/core/src/main/java/org/enginehub/piston/converter/ArgumentConverter.java b/core/src/main/java/org/enginehub/piston/converter/ArgumentConverter.java index cd08618..7d5b734 100644 --- a/core/src/main/java/org/enginehub/piston/converter/ArgumentConverter.java +++ b/core/src/main/java/org/enginehub/piston/converter/ArgumentConverter.java @@ -19,7 +19,7 @@ package org.enginehub.piston.converter; -import net.kyori.text.Component; +import net.kyori.adventure.text.Component; import org.enginehub.piston.inject.InjectedValueAccess; import java.util.Collections; diff --git a/core/src/main/java/org/enginehub/piston/converter/ForwardingArgumentConverter.java b/core/src/main/java/org/enginehub/piston/converter/ForwardingArgumentConverter.java index d7dcb58..b03e0d5 100644 --- a/core/src/main/java/org/enginehub/piston/converter/ForwardingArgumentConverter.java +++ b/core/src/main/java/org/enginehub/piston/converter/ForwardingArgumentConverter.java @@ -19,7 +19,7 @@ package org.enginehub.piston.converter; -import net.kyori.text.Component; +import net.kyori.adventure.text.Component; import org.enginehub.piston.inject.InjectedValueAccess; import java.util.List; diff --git a/core/src/main/java/org/enginehub/piston/converter/MapArgumentConverter.java b/core/src/main/java/org/enginehub/piston/converter/MapArgumentConverter.java index 9adfec3..2bbde21 100644 --- a/core/src/main/java/org/enginehub/piston/converter/MapArgumentConverter.java +++ b/core/src/main/java/org/enginehub/piston/converter/MapArgumentConverter.java @@ -20,7 +20,7 @@ package org.enginehub.piston.converter; import com.google.common.collect.ImmutableMap; -import net.kyori.text.Component; +import net.kyori.adventure.text.Component; import org.enginehub.piston.config.ColorConfig; import org.enginehub.piston.inject.InjectedValueAccess; diff --git a/core/src/main/java/org/enginehub/piston/converter/MultiKeyConverter.java b/core/src/main/java/org/enginehub/piston/converter/MultiKeyConverter.java index 9468785..49ce8dc 100644 --- a/core/src/main/java/org/enginehub/piston/converter/MultiKeyConverter.java +++ b/core/src/main/java/org/enginehub/piston/converter/MultiKeyConverter.java @@ -26,7 +26,7 @@ import com.google.common.collect.ImmutableSortedMap; import com.google.common.collect.Maps; import com.google.common.collect.SetMultimap; -import net.kyori.text.Component; +import net.kyori.adventure.text.Component; import org.enginehub.piston.config.ColorConfig; import org.enginehub.piston.inject.InjectedValueAccess; diff --git a/core/src/main/java/org/enginehub/piston/converter/SimpleArgumentConverter.java b/core/src/main/java/org/enginehub/piston/converter/SimpleArgumentConverter.java index 7ba79f2..1a81428 100644 --- a/core/src/main/java/org/enginehub/piston/converter/SimpleArgumentConverter.java +++ b/core/src/main/java/org/enginehub/piston/converter/SimpleArgumentConverter.java @@ -19,8 +19,8 @@ package org.enginehub.piston.converter; -import net.kyori.text.Component; -import net.kyori.text.TextComponent; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; import org.enginehub.piston.inject.InjectedValueAccess; import java.util.List; diff --git a/core/src/main/java/org/enginehub/piston/exception/CommandException.java b/core/src/main/java/org/enginehub/piston/exception/CommandException.java index 289cd50..05289a7 100644 --- a/core/src/main/java/org/enginehub/piston/exception/CommandException.java +++ b/core/src/main/java/org/enginehub/piston/exception/CommandException.java @@ -20,8 +20,8 @@ package org.enginehub.piston.exception; import com.google.common.collect.ImmutableList; -import net.kyori.text.Component; -import net.kyori.text.TextComponent; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; import org.enginehub.piston.Command; import org.enginehub.piston.util.TextHelper; diff --git a/core/src/main/java/org/enginehub/piston/exception/ConditionFailedException.java b/core/src/main/java/org/enginehub/piston/exception/ConditionFailedException.java index a0dbac1..d904150 100644 --- a/core/src/main/java/org/enginehub/piston/exception/ConditionFailedException.java +++ b/core/src/main/java/org/enginehub/piston/exception/ConditionFailedException.java @@ -21,7 +21,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; -import net.kyori.text.TextComponent; +import net.kyori.adventure.text.TextComponent; import org.enginehub.piston.Command; public class ConditionFailedException extends CommandException { diff --git a/core/src/main/java/org/enginehub/piston/exception/ConversionFailedException.java b/core/src/main/java/org/enginehub/piston/exception/ConversionFailedException.java index cbf47ff..34e8687 100644 --- a/core/src/main/java/org/enginehub/piston/exception/ConversionFailedException.java +++ b/core/src/main/java/org/enginehub/piston/exception/ConversionFailedException.java @@ -19,8 +19,8 @@ package org.enginehub.piston.exception; -import net.kyori.text.Component; -import net.kyori.text.TextComponent; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; import org.enginehub.piston.CommandParseResult; import org.enginehub.piston.CommandValue; import org.enginehub.piston.converter.ArgumentConverter; diff --git a/core/src/main/java/org/enginehub/piston/exception/NoSuchCommandException.java b/core/src/main/java/org/enginehub/piston/exception/NoSuchCommandException.java index 8a00bfe..257783a 100644 --- a/core/src/main/java/org/enginehub/piston/exception/NoSuchCommandException.java +++ b/core/src/main/java/org/enginehub/piston/exception/NoSuchCommandException.java @@ -20,7 +20,7 @@ package org.enginehub.piston.exception; import com.google.common.collect.ImmutableList; -import net.kyori.text.TextComponent; +import net.kyori.adventure.text.TextComponent; public class NoSuchCommandException extends CommandException { diff --git a/core/src/main/java/org/enginehub/piston/exception/NoSuchFlagException.java b/core/src/main/java/org/enginehub/piston/exception/NoSuchFlagException.java index b5d0fe0..67fffc6 100644 --- a/core/src/main/java/org/enginehub/piston/exception/NoSuchFlagException.java +++ b/core/src/main/java/org/enginehub/piston/exception/NoSuchFlagException.java @@ -21,8 +21,8 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; -import net.kyori.text.Component; -import net.kyori.text.TextComponent; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; import org.enginehub.piston.Command; import org.enginehub.piston.CommandParseResult; import org.enginehub.piston.config.ColorConfig; diff --git a/core/src/main/java/org/enginehub/piston/exception/StopExecutionException.java b/core/src/main/java/org/enginehub/piston/exception/StopExecutionException.java index 6ac59ab..1ee873d 100644 --- a/core/src/main/java/org/enginehub/piston/exception/StopExecutionException.java +++ b/core/src/main/java/org/enginehub/piston/exception/StopExecutionException.java @@ -20,7 +20,7 @@ package org.enginehub.piston.exception; import com.google.common.collect.ImmutableList; -import net.kyori.text.Component; +import net.kyori.adventure.text.Component; import org.enginehub.piston.Command; /** diff --git a/core/src/main/java/org/enginehub/piston/exception/UsageException.java b/core/src/main/java/org/enginehub/piston/exception/UsageException.java index 698c59e..cf7bd65 100644 --- a/core/src/main/java/org/enginehub/piston/exception/UsageException.java +++ b/core/src/main/java/org/enginehub/piston/exception/UsageException.java @@ -19,7 +19,7 @@ package org.enginehub.piston.exception; -import net.kyori.text.Component; +import net.kyori.adventure.text.Component; import org.enginehub.piston.CommandParseResult; /** diff --git a/core/src/main/java/org/enginehub/piston/part/ArgAcceptingCommandFlag.java b/core/src/main/java/org/enginehub/piston/part/ArgAcceptingCommandFlag.java index 2e068c4..737094e 100644 --- a/core/src/main/java/org/enginehub/piston/part/ArgAcceptingCommandFlag.java +++ b/core/src/main/java/org/enginehub/piston/part/ArgAcceptingCommandFlag.java @@ -21,9 +21,9 @@ import com.google.auto.value.AutoValue; import com.google.common.collect.ImmutableList; -import net.kyori.text.Component; -import net.kyori.text.TextComponent; -import net.kyori.text.TranslatableComponent; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.TranslatableComponent; import org.enginehub.piston.config.ColorConfig; import org.enginehub.piston.inject.Key; diff --git a/core/src/main/java/org/enginehub/piston/part/ArgConsumingCommandPart.java b/core/src/main/java/org/enginehub/piston/part/ArgConsumingCommandPart.java index 72a17c0..36e93c3 100644 --- a/core/src/main/java/org/enginehub/piston/part/ArgConsumingCommandPart.java +++ b/core/src/main/java/org/enginehub/piston/part/ArgConsumingCommandPart.java @@ -19,7 +19,7 @@ package org.enginehub.piston.part; -import net.kyori.text.TranslatableComponent; +import net.kyori.adventure.text.TranslatableComponent; /** * Marker interface for parts that consume arguments directly from the line, diff --git a/core/src/main/java/org/enginehub/piston/part/CommandArgument.java b/core/src/main/java/org/enginehub/piston/part/CommandArgument.java index 62d02ab..e922475 100644 --- a/core/src/main/java/org/enginehub/piston/part/CommandArgument.java +++ b/core/src/main/java/org/enginehub/piston/part/CommandArgument.java @@ -22,9 +22,9 @@ import com.google.auto.value.AutoValue; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; -import net.kyori.text.Component; -import net.kyori.text.TextComponent; -import net.kyori.text.TranslatableComponent; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.TranslatableComponent; import org.enginehub.piston.config.ColorConfig; import org.enginehub.piston.inject.Key; diff --git a/core/src/main/java/org/enginehub/piston/part/CommandPart.java b/core/src/main/java/org/enginehub/piston/part/CommandPart.java index 26685d3..12d2420 100644 --- a/core/src/main/java/org/enginehub/piston/part/CommandPart.java +++ b/core/src/main/java/org/enginehub/piston/part/CommandPart.java @@ -19,7 +19,7 @@ package org.enginehub.piston.part; -import net.kyori.text.Component; +import net.kyori.adventure.text.Component; import org.enginehub.piston.CommandParameters; /** diff --git a/core/src/main/java/org/enginehub/piston/part/CommandParts.java b/core/src/main/java/org/enginehub/piston/part/CommandParts.java index 313ccdb..eca7a49 100644 --- a/core/src/main/java/org/enginehub/piston/part/CommandParts.java +++ b/core/src/main/java/org/enginehub/piston/part/CommandParts.java @@ -19,8 +19,8 @@ package org.enginehub.piston.part; -import net.kyori.text.Component; -import net.kyori.text.TranslatableComponent; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TranslatableComponent; public class CommandParts { diff --git a/core/src/main/java/org/enginehub/piston/part/NoArgCommandFlag.java b/core/src/main/java/org/enginehub/piston/part/NoArgCommandFlag.java index c836509..aa28b5a 100644 --- a/core/src/main/java/org/enginehub/piston/part/NoArgCommandFlag.java +++ b/core/src/main/java/org/enginehub/piston/part/NoArgCommandFlag.java @@ -20,8 +20,8 @@ package org.enginehub.piston.part; import com.google.auto.value.AutoValue; -import net.kyori.text.Component; -import net.kyori.text.TextComponent; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; import org.enginehub.piston.config.ColorConfig; @AutoValue diff --git a/core/src/main/java/org/enginehub/piston/part/SubCommandPart.java b/core/src/main/java/org/enginehub/piston/part/SubCommandPart.java index 3c119c7..d284986 100644 --- a/core/src/main/java/org/enginehub/piston/part/SubCommandPart.java +++ b/core/src/main/java/org/enginehub/piston/part/SubCommandPart.java @@ -21,9 +21,9 @@ import com.google.auto.value.AutoValue; import com.google.common.collect.ImmutableList; -import net.kyori.text.Component; -import net.kyori.text.TextComponent; -import net.kyori.text.TranslatableComponent; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.TranslatableComponent; import org.enginehub.piston.Command; import org.enginehub.piston.config.ColorConfig; diff --git a/core/src/main/java/org/enginehub/piston/util/ComponentHelper.java b/core/src/main/java/org/enginehub/piston/util/ComponentHelper.java index c35c3be..15e0f9e 100644 --- a/core/src/main/java/org/enginehub/piston/util/ComponentHelper.java +++ b/core/src/main/java/org/enginehub/piston/util/ComponentHelper.java @@ -19,8 +19,8 @@ package org.enginehub.piston.util; -import net.kyori.text.Component; -import net.kyori.text.TextComponent; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; import org.enginehub.piston.config.ColorConfig; import javax.annotation.Nullable; diff --git a/core/src/main/java/org/enginehub/piston/util/HelpGenerator.java b/core/src/main/java/org/enginehub/piston/util/HelpGenerator.java index 3eb874b..f931e39 100644 --- a/core/src/main/java/org/enginehub/piston/util/HelpGenerator.java +++ b/core/src/main/java/org/enginehub/piston/util/HelpGenerator.java @@ -20,8 +20,8 @@ package org.enginehub.piston.util; import com.google.common.collect.ImmutableList; -import net.kyori.text.Component; -import net.kyori.text.TextComponent; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; import org.enginehub.piston.ArgBinding; import org.enginehub.piston.Command; import org.enginehub.piston.CommandMetadata; @@ -42,8 +42,8 @@ import java.util.List; import java.util.stream.Collectors; -import static net.kyori.text.TextComponent.newline; -import static net.kyori.text.TextComponent.space; +import static net.kyori.adventure.text.TextComponent.newline; +import static net.kyori.adventure.text.TextComponent.space; public class HelpGenerator { diff --git a/core/src/main/java/org/enginehub/piston/util/PartHelper.java b/core/src/main/java/org/enginehub/piston/util/PartHelper.java index ff2235a..fa85cc7 100644 --- a/core/src/main/java/org/enginehub/piston/util/PartHelper.java +++ b/core/src/main/java/org/enginehub/piston/util/PartHelper.java @@ -19,8 +19,8 @@ package org.enginehub.piston.util; -import net.kyori.text.Component; -import net.kyori.text.TextComponent; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; import org.enginehub.piston.Command; import org.enginehub.piston.config.ColorConfig; import org.enginehub.piston.part.CommandPart; diff --git a/core/src/main/java/org/enginehub/piston/util/TextHelper.java b/core/src/main/java/org/enginehub/piston/util/TextHelper.java index fbeacf5..aa5a567 100644 --- a/core/src/main/java/org/enginehub/piston/util/TextHelper.java +++ b/core/src/main/java/org/enginehub/piston/util/TextHelper.java @@ -20,10 +20,10 @@ package org.enginehub.piston.util; import com.google.common.base.Joiner; -import net.kyori.text.Component; -import net.kyori.text.KeybindComponent; -import net.kyori.text.TranslatableComponent; -import net.kyori.text.serializer.plain.PlainComponentSerializer; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.KeybindComponent; +import net.kyori.adventure.text.TranslatableComponent; +import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer; import org.enginehub.piston.config.ConfigHolder; import org.enginehub.piston.config.ConfigRenderer; diff --git a/core/src/test/java/org/enginehub/piston/config/ConfigHolderTest.java b/core/src/test/java/org/enginehub/piston/config/ConfigHolderTest.java index 9b958c6..26f6e39 100644 --- a/core/src/test/java/org/enginehub/piston/config/ConfigHolderTest.java +++ b/core/src/test/java/org/enginehub/piston/config/ConfigHolderTest.java @@ -20,10 +20,10 @@ package org.enginehub.piston.config; import com.google.common.collect.ImmutableList; -import net.kyori.text.Component; -import net.kyori.text.TextComponent; -import net.kyori.text.TranslatableComponent; -import net.kyori.text.format.TextColor; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.TranslatableComponent; +import net.kyori.adventure.text.format.NamedTextColor; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DynamicNode; @@ -54,7 +54,7 @@ private TestCase(String name, Component input, Component expected) { private final ConfigHolder holder = ConfigHolder.create(); private final Component inputWithStyles = ColorConfig.helpText() .wrap(TextConfig.commandPrefixValue()); - private final TextComponent outputStyled = TextComponent.of("prefix!", TextColor.DARK_PURPLE); + private final TextComponent outputStyled = TextComponent.of("prefix!", NamedTextColor.DARK_PURPLE); @BeforeEach void setUp() { diff --git a/core/src/test/java/org/enginehub/piston/exception/ConstructionTest.java b/core/src/test/java/org/enginehub/piston/exception/ConstructionTest.java index ab9823a..685bb8b 100644 --- a/core/src/test/java/org/enginehub/piston/exception/ConstructionTest.java +++ b/core/src/test/java/org/enginehub/piston/exception/ConstructionTest.java @@ -20,8 +20,8 @@ package org.enginehub.piston.exception; import com.google.common.collect.ImmutableList; -import net.kyori.text.Component; -import net.kyori.text.TextComponent; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; import org.enginehub.piston.Command; import org.enginehub.piston.CommandParseResult; import org.enginehub.piston.NoInputCommandParameters; diff --git a/default-impl/src/main/java/org/enginehub/piston/impl/CommandImpl.java b/default-impl/src/main/java/org/enginehub/piston/impl/CommandImpl.java index 83175c4..2a664c7 100644 --- a/default-impl/src/main/java/org/enginehub/piston/impl/CommandImpl.java +++ b/default-impl/src/main/java/org/enginehub/piston/impl/CommandImpl.java @@ -21,22 +21,16 @@ import com.google.auto.value.AutoValue; import com.google.common.collect.ImmutableList; -import net.kyori.text.Component; -import net.kyori.text.TextComponent; +import net.kyori.adventure.text.Component; import org.enginehub.piston.Command; -import org.enginehub.piston.part.CommandArgument; -import org.enginehub.piston.part.CommandFlag; import org.enginehub.piston.part.CommandPart; import org.enginehub.piston.suggestion.DefaultSuggestionProvider; import org.enginehub.piston.suggestion.SuggestionProvider; import javax.annotation.Nullable; import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; import static com.google.common.base.Preconditions.checkState; -import static net.kyori.text.TextComponent.newline; import static org.enginehub.piston.Command.Action.NULL_ACTION; @AutoValue diff --git a/default-impl/src/main/java/org/enginehub/piston/impl/CommandParser.java b/default-impl/src/main/java/org/enginehub/piston/impl/CommandParser.java index 2f857a0..7a62818 100644 --- a/default-impl/src/main/java/org/enginehub/piston/impl/CommandParser.java +++ b/default-impl/src/main/java/org/enginehub/piston/impl/CommandParser.java @@ -40,8 +40,8 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterators; -import net.kyori.text.Component; -import net.kyori.text.TextComponent; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; import org.apache.logging.log4j.Logger; import org.enginehub.piston.Command; import org.enginehub.piston.CommandMetadata; diff --git a/default-impl/src/test/java/org/enginehub/piston/impl/CommandManagerTest.java b/default-impl/src/test/java/org/enginehub/piston/impl/CommandManagerTest.java index e0cf013..6a88d2c 100644 --- a/default-impl/src/test/java/org/enginehub/piston/impl/CommandManagerTest.java +++ b/default-impl/src/test/java/org/enginehub/piston/impl/CommandManagerTest.java @@ -20,8 +20,8 @@ package org.enginehub.piston.impl; import com.google.common.collect.ImmutableList; -import net.kyori.text.TextComponent; -import net.kyori.text.TranslatableComponent; +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.TranslatableComponent; import org.enginehub.piston.Command; import org.enginehub.piston.CommandManager; import org.enginehub.piston.exception.ConditionFailedException; From 477e59d63cc1baca825eb89a88a5a9a9f2a5aa5f Mon Sep 17 00:00:00 2001 From: Octavia Togami Date: Tue, 11 Aug 2020 00:49:43 -0700 Subject: [PATCH 2/7] Cleanup imports --- .../org/enginehub/piston/RegressionTest.kt | 1 - .../org/enginehub/piston/ConditionTest.java | 1 - .../enginehub/piston/impl/CommandParser.java | 31 +++++++++---------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/core-ap/processor/src/test/kotlin/org/enginehub/piston/RegressionTest.kt b/core-ap/processor/src/test/kotlin/org/enginehub/piston/RegressionTest.kt index c1f5a35..04c226d 100644 --- a/core-ap/processor/src/test/kotlin/org/enginehub/piston/RegressionTest.kt +++ b/core-ap/processor/src/test/kotlin/org/enginehub/piston/RegressionTest.kt @@ -36,7 +36,6 @@ import org.junit.jupiter.api.assertThrows import org.mockito.Mockito.mock import org.mockito.Mockito.times import org.mockito.Mockito.verify -import org.mockito.Mockito.verifyNoInteractions @DisplayName("Regression tests") class RegressionTest { diff --git a/core/src/test/java/org/enginehub/piston/ConditionTest.java b/core/src/test/java/org/enginehub/piston/ConditionTest.java index 05464d3..855ed29 100644 --- a/core/src/test/java/org/enginehub/piston/ConditionTest.java +++ b/core/src/test/java/org/enginehub/piston/ConditionTest.java @@ -19,7 +19,6 @@ package org.enginehub.piston; -import org.enginehub.piston.inject.InjectedValueAccess; import org.junit.jupiter.api.Test; import static org.enginehub.piston.Command.Condition.FALSE; diff --git a/default-impl/src/main/java/org/enginehub/piston/impl/CommandParser.java b/default-impl/src/main/java/org/enginehub/piston/impl/CommandParser.java index 7a62818..57138c2 100644 --- a/default-impl/src/main/java/org/enginehub/piston/impl/CommandParser.java +++ b/default-impl/src/main/java/org/enginehub/piston/impl/CommandParser.java @@ -19,22 +19,6 @@ package org.enginehub.piston.impl; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; -import static java.util.Objects.requireNonNull; - - -import javax.annotation.Nullable; -import java.util.HashSet; -import java.util.Iterator; -import java.util.ListIterator; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.concurrent.ThreadLocalRandom; -import java.util.function.Consumer; -import java.util.stream.Collectors; - import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -67,6 +51,21 @@ import org.enginehub.piston.util.ComponentHelper; import org.enginehub.piston.util.StreamHelper; +import javax.annotation.Nullable; +import java.util.HashSet; +import java.util.Iterator; +import java.util.ListIterator; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.concurrent.ThreadLocalRandom; +import java.util.function.Consumer; +import java.util.stream.Collectors; + +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Preconditions.checkState; +import static java.util.Objects.requireNonNull; + class CommandParser { private static final Logger LOGGER = LogManagerCompat.getLogger(); From de0dbac3d4ab3018c7e02267149f80715774baf6 Mon Sep 17 00:00:00 2001 From: Octavia Togami Date: Mon, 28 Sep 2020 14:38:26 -0700 Subject: [PATCH 3/7] Continue the adventure --- .../piston/gen/util/CodeBlockUtil.java | 7 ++- .../org/enginehub/piston/RegressionTest.kt | 14 +++--- .../org/enginehub/piston/TestSupport.kt | 15 +++---- .../suggestion/ManagerSuggestionTest.kt | 7 +-- .../suggestion/SimpleSuggestingConverter.kt | 2 +- .../piston/util/HelpGeneratorTest.kt | 10 ++--- .../gen/CollectionArgRegistration.java | 11 +++-- .../gen/CommandValueArgRegistration.java | 8 ++-- .../test/resources/gen/FlagsRegistration.java | 19 ++++---- .../resources/gen/IntArgRegistration.java | 23 +++++----- .../test/resources/gen/NoArgRegistration.java | 12 +++--- .../gen/NonArgParametersRegistration.java | 6 +-- .../gen/Outer_BasicNestedRegistration.java | 4 +- .../enginehub/piston/config/ColorConfig.java | 6 +-- .../org/enginehub/piston/config/Config.java | 2 +- .../enginehub/piston/config/TextConfig.java | 5 ++- .../converter/SimpleArgumentConverter.java | 3 +- .../piston/exception/CommandException.java | 5 +-- .../exception/ConditionFailedException.java | 4 +- .../exception/ConversionFailedException.java | 8 ++-- .../exception/NoSuchCommandException.java | 4 +- .../piston/exception/NoSuchFlagException.java | 10 ++--- .../piston/part/ArgAcceptingCommandFlag.java | 15 +++---- .../piston/part/CommandArgument.java | 9 ++-- .../piston/part/NoArgCommandFlag.java | 9 ++-- .../enginehub/piston/part/SubCommandPart.java | 7 ++- .../piston/util/ComponentHelper.java | 8 ++-- .../enginehub/piston/util/HelpGenerator.java | 43 +++++++++---------- .../org/enginehub/piston/util/PartHelper.java | 18 ++++---- .../piston/config/ConfigHolderTest.java | 11 +++-- .../piston/exception/ConstructionTest.java | 15 +++---- .../enginehub/piston/impl/CommandParser.java | 31 +++++++------ .../piston/impl/CommandManagerTest.java | 11 +++-- 33 files changed, 175 insertions(+), 187 deletions(-) diff --git a/core-ap/processor/src/main/java/org/enginehub/piston/gen/util/CodeBlockUtil.java b/core-ap/processor/src/main/java/org/enginehub/piston/gen/util/CodeBlockUtil.java index fafec38..570414e 100644 --- a/core-ap/processor/src/main/java/org/enginehub/piston/gen/util/CodeBlockUtil.java +++ b/core-ap/processor/src/main/java/org/enginehub/piston/gen/util/CodeBlockUtil.java @@ -22,8 +22,7 @@ import com.google.common.collect.ImmutableList; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.TypeName; -import net.kyori.adventure.text.TextComponent; -import net.kyori.adventure.text.TranslatableComponent; +import net.kyori.adventure.text.Component; import org.enginehub.piston.internal.RegistrationUtil; import javax.annotation.Nullable; @@ -72,11 +71,11 @@ public static CodeBlock listForGen(Stream rawCode) { } public static CodeBlock textCompOf(String text) { - return CodeBlock.of("$T.of($S)", TextComponent.class, text); + return CodeBlock.of("$T.text($S)", Component.class, text); } public static CodeBlock transCompOf(String text) { - return CodeBlock.of("$T.of($S)", TranslatableComponent.class, text); + return CodeBlock.of("$T.translatable($S)", Component.class, text); } public static Collector joining(String delimiter) { diff --git a/core-ap/processor/src/test/kotlin/org/enginehub/piston/RegressionTest.kt b/core-ap/processor/src/test/kotlin/org/enginehub/piston/RegressionTest.kt index 04c226d..44a47a4 100644 --- a/core-ap/processor/src/test/kotlin/org/enginehub/piston/RegressionTest.kt +++ b/core-ap/processor/src/test/kotlin/org/enginehub/piston/RegressionTest.kt @@ -19,7 +19,7 @@ package org.enginehub.piston -import net.kyori.adventure.text.TextComponent +import net.kyori.adventure.text.Component import org.enginehub.piston.commands.RegressionCommands import org.enginehub.piston.commands.RegressionCommandsRegistration import org.enginehub.piston.converter.SimpleArgumentConverter @@ -93,10 +93,10 @@ class RegressionTest { action(it.valueOf(arg).asString()) 1 } - .description(TextComponent.of("Sub-command")) + .description(Component.text("Sub-command")) .build() cmd.run { - description(TextComponent.of("Issue 9 #2")) + description(Component.text("Issue 9 #2")) // Optional arg prior to sub-command addPart(arg) addPart(subs(sub)) @@ -136,11 +136,11 @@ class RegressionTest { } val sub = manager.newCommand("vert") .action { SUB_ACTION } - .description(TextComponent.of("Sub-command")) + .description(Component.text("Sub-command")) .build() cmd.run { action { ROOT_ACTION } - description(TextComponent.of("Issue 14")) + description(Component.text("Issue 14")) addPart(subs(sub, required = false)) addPart(req) addPart(optAfter) @@ -170,10 +170,10 @@ class RegressionTest { val sub = manager.newCommand("world") .action { SUB_ACTION } .aliases(setOf("there")) - .description(TextComponent.of("Sub-command")) + .description(Component.text("Sub-command")) .build() cmd.run { - description(TextComponent.of("hello")) + description(Component.text("hello")) addPart(subs(sub, required = true)) } } diff --git a/core-ap/processor/src/test/kotlin/org/enginehub/piston/TestSupport.kt b/core-ap/processor/src/test/kotlin/org/enginehub/piston/TestSupport.kt index abfecee..f083fb7 100644 --- a/core-ap/processor/src/test/kotlin/org/enginehub/piston/TestSupport.kt +++ b/core-ap/processor/src/test/kotlin/org/enginehub/piston/TestSupport.kt @@ -21,8 +21,7 @@ package org.enginehub.piston import com.google.common.collect.ImmutableList import com.google.common.collect.ImmutableSet -import net.kyori.adventure.text.TextComponent -import net.kyori.adventure.text.TranslatableComponent +import net.kyori.adventure.text.Component import org.enginehub.piston.gen.CommandRegistration import org.enginehub.piston.part.ArgAcceptingCommandFlag import org.enginehub.piston.part.CommandArgument @@ -56,21 +55,21 @@ inline fun withMockedContainer(block: (CI) -> Unit) { inline fun arg(name: String, desc: String, block: CommandArgument.Builder.() -> Unit = {}): CommandArgument = CommandParts.arg( - TranslatableComponent.of(name), - TextComponent.of(desc) + Component.translatable(name), + Component.text(desc) ).also(block).build() inline fun flag(name: Char, desc: String, block: NoArgCommandFlag.Builder.() -> Unit = {}): NoArgCommandFlag = CommandParts.flag( name, - TextComponent.of(desc) + Component.text(desc) ).also(block).build() inline fun argFlag(name: Char, desc: String, argName: String, block: ArgAcceptingCommandFlag.Builder.() -> Unit = {}): ArgAcceptingCommandFlag = CommandParts.flag( name, - TextComponent.of(desc) + Component.text(desc) ) .withRequiredArg() .argNamed(argName) @@ -78,8 +77,8 @@ inline fun argFlag(name: Char, desc: String, argName: String, fun subs(vararg subCommands: Command, required: Boolean = true): SubCommandPart = SubCommandPart.builder( - TranslatableComponent.of("actions"), - TextComponent.of("Sub-actions") + Component.translatable("actions"), + Component.text("Sub-actions") ).run { withCommands(ImmutableList.copyOf(subCommands)) diff --git a/core-ap/processor/src/test/kotlin/org/enginehub/piston/suggestion/ManagerSuggestionTest.kt b/core-ap/processor/src/test/kotlin/org/enginehub/piston/suggestion/ManagerSuggestionTest.kt index 0b116c4..bea17ab 100644 --- a/core-ap/processor/src/test/kotlin/org/enginehub/piston/suggestion/ManagerSuggestionTest.kt +++ b/core-ap/processor/src/test/kotlin/org/enginehub/piston/suggestion/ManagerSuggestionTest.kt @@ -19,6 +19,7 @@ package org.enginehub.piston.suggestion +import net.kyori.adventure.text.Component import net.kyori.adventure.text.TextComponent import org.enginehub.piston.Command import org.enginehub.piston.CommandManager @@ -57,12 +58,12 @@ class ManagerSuggestionTest { } register("notpermitted") { cmd -> - cmd.description(TextComponent.of("Command with false condition")) + cmd.description(Component.text("Command with false condition")) cmd.condition(Command.Condition.FALSE) } register("sub") { cmd -> - cmd.description(TextComponent.of("Sub-commands test command")) + cmd.description(Component.text("Sub-commands test command")) cmd.addPart(subs(*allCommands.toList().toTypedArray())) } } @@ -91,7 +92,7 @@ class ManagerSuggestionTest { withSuggestionManager { manager -> manager.registerManager(newManager().apply { register("permitted") { cmd -> - cmd.description(TextComponent.of("Command with true condition")) + cmd.description(Component.text("Command with true condition")) cmd.condition(Command.Condition.TRUE) } }) diff --git a/core-ap/processor/src/test/kotlin/org/enginehub/piston/suggestion/SimpleSuggestingConverter.kt b/core-ap/processor/src/test/kotlin/org/enginehub/piston/suggestion/SimpleSuggestingConverter.kt index d005dbc..15b3d69 100644 --- a/core-ap/processor/src/test/kotlin/org/enginehub/piston/suggestion/SimpleSuggestingConverter.kt +++ b/core-ap/processor/src/test/kotlin/org/enginehub/piston/suggestion/SimpleSuggestingConverter.kt @@ -37,7 +37,7 @@ class SimpleSuggestingConverter(private val suggestions: List) : Argumen } override fun describeAcceptableArguments(): Component { - return TextComponent.of("Any of $suggestions") + return Component.text("Any of $suggestions") } override fun getSuggestions(input: String, context: InjectedValueAccess): List = diff --git a/core-ap/processor/src/test/kotlin/org/enginehub/piston/util/HelpGeneratorTest.kt b/core-ap/processor/src/test/kotlin/org/enginehub/piston/util/HelpGeneratorTest.kt index f37857f..fc4b04c 100644 --- a/core-ap/processor/src/test/kotlin/org/enginehub/piston/util/HelpGeneratorTest.kt +++ b/core-ap/processor/src/test/kotlin/org/enginehub/piston/util/HelpGeneratorTest.kt @@ -20,7 +20,7 @@ package org.enginehub.piston.util import com.google.common.collect.ImmutableList -import net.kyori.adventure.text.TextComponent +import net.kyori.adventure.text.Component import org.enginehub.piston.TestCommandMetadata import org.enginehub.piston.TestCommandParameters import org.enginehub.piston.TestParseResult @@ -98,7 +98,7 @@ class HelpGeneratorTest { @Test fun singleArgOptionalNotNoneHelp() { val command = listOf(newManager().newCommand("single-arg-opt") - .description(TextComponent.of("description")) + .description(Component.text("description")) .addParts( arg("piston.argument.first","First argument") { defaultsTo(ImmutableList.of("a", "b")) @@ -116,7 +116,7 @@ class HelpGeneratorTest { @Test fun flagsHelp() { val command = listOf(newManager().newCommand("flags") - .description(TextComponent.of("description")) + .description(Component.text("description")) .addParts( flag('f', "Flag"), argFlag('q', "Quibble", "qux"), @@ -138,12 +138,12 @@ class HelpGeneratorTest { @Test fun subCommandsHelp() { val subCommand = newManager().newCommand("sub-command") - .description(TextComponent.of("sub-description")) + .description(Component.text("sub-description")) .build() val interArg = arg("intermediate", "inter-arg") val subCommands = subs(subCommand) val command = newManager().newCommand("main") - .description(TextComponent.of("description")) + .description(Component.text("description")) .addParts(interArg, subCommands) .build() assertEquals(""" diff --git a/core-ap/processor/src/test/resources/gen/CollectionArgRegistration.java b/core-ap/processor/src/test/resources/gen/CollectionArgRegistration.java index e4a2d90..d4dd37e 100644 --- a/core-ap/processor/src/test/resources/gen/CollectionArgRegistration.java +++ b/core-ap/processor/src/test/resources/gen/CollectionArgRegistration.java @@ -34,8 +34,7 @@ import java.lang.Throwable; import java.lang.reflect.Method; import java.util.Collection; -import net.kyori.adventure.text.TextComponent; -import net.kyori.adventure.text.TranslatableComponent; +import net.kyori.adventure.text.Component; import org.enginehub.piston.CommandManager; import org.enginehub.piston.CommandParameters; import org.enginehub.piston.gen.CommandCallListener; @@ -53,12 +52,12 @@ final class CollectionArgRegistration implements CommandRegistration listeners; - private final CommandArgument argPart = arg(TranslatableComponent.of("piston.argument.arg"), TextComponent.of("ARG DESCRIPTION")) + private final CommandArgument argPart = arg(Component.translatable("piston.argument.arg"), Component.text("ARG DESCRIPTION")) .defaultsTo(ImmutableList.of()) .ofTypes(ImmutableList.of(string_Key)) .build(); - private final CommandArgument argPart2 = arg(TranslatableComponent.of("piston.argument.arg"), TextComponent.of("ARG DESCRIPTION")) + private final CommandArgument argPart2 = arg(Component.translatable("piston.argument.arg"), Component.text("ARG DESCRIPTION")) .defaultsTo(ImmutableList.of()) .ofTypes(ImmutableList.of(object_Key)) .build(); @@ -89,13 +88,13 @@ public CollectionArgRegistration listeners(Collection liste public void build() { commandManager.register("collectionArgument", b -> { b.aliases(ImmutableList.of()); - b.description(TextComponent.of("DESCRIPTION")); + b.description(Component.text("DESCRIPTION")); b.parts(ImmutableList.of(argPart)); b.action(this::cmd$collectionArgument); }); commandManager.register("objectArgument", b -> { b.aliases(ImmutableList.of()); - b.description(TextComponent.of("DESCRIPTION")); + b.description(Component.text("DESCRIPTION")); b.parts(ImmutableList.of(argPart2)); b.action(this::cmd$objectArgument); }); diff --git a/core-ap/processor/src/test/resources/gen/CommandValueArgRegistration.java b/core-ap/processor/src/test/resources/gen/CommandValueArgRegistration.java index 7d39cf9..f80879b 100644 --- a/core-ap/processor/src/test/resources/gen/CommandValueArgRegistration.java +++ b/core-ap/processor/src/test/resources/gen/CommandValueArgRegistration.java @@ -32,8 +32,8 @@ import java.lang.Throwable; import java.lang.reflect.Method; import java.util.Collection; -import net.kyori.adventure.text.TextComponent; -import net.kyori.adventure.text.TranslatableComponent; + +import net.kyori.adventure.text.Component; import org.enginehub.piston.CommandManager; import org.enginehub.piston.CommandParameters; import org.enginehub.piston.CommandValue; @@ -48,7 +48,7 @@ final class CommandValueArgRegistration implements CommandRegistration listeners; - private final CommandArgument argPart = arg(TranslatableComponent.of("piston.argument.arg"), TextComponent.of("ARG DESCRIPTION")) + private final CommandArgument argPart = arg(Component.translatable("piston.argument.arg"), Component.text("ARG DESCRIPTION")) .defaultsTo(ImmutableList.of()) .build(); @@ -78,7 +78,7 @@ public CommandValueArgRegistration listeners(Collection lis public void build() { commandManager.register("valueArgument", b -> { b.aliases(ImmutableList.of()); - b.description(TextComponent.of("DESCRIPTION")); + b.description(Component.text("DESCRIPTION")); b.parts(ImmutableList.of(argPart)); b.action(this::cmd$valueArgument); }); diff --git a/core-ap/processor/src/test/resources/gen/FlagsRegistration.java b/core-ap/processor/src/test/resources/gen/FlagsRegistration.java index d0dcaf9..39feb0f 100644 --- a/core-ap/processor/src/test/resources/gen/FlagsRegistration.java +++ b/core-ap/processor/src/test/resources/gen/FlagsRegistration.java @@ -32,8 +32,7 @@ import java.lang.Throwable; import java.lang.reflect.Method; import java.util.Collection; -import net.kyori.adventure.text.TextComponent; -import net.kyori.adventure.text.TranslatableComponent; +import net.kyori.adventure.text.Component; import org.enginehub.piston.CommandManager; import org.enginehub.piston.CommandParameters; import org.enginehub.piston.gen.CommandCallListener; @@ -50,18 +49,18 @@ final class FlagsRegistration implements CommandRegistration { private ImmutableList listeners; - private final NoArgCommandFlag flagPart = flag('f', TextComponent.of("ARG DESCRIPTION")).build(); + private final NoArgCommandFlag flagPart = flag('f', Component.text("ARG DESCRIPTION")).build(); - private final ArgAcceptingCommandFlag flagPart2 = flag('f', TextComponent.of("ARG DESCRIPTION")) + private final ArgAcceptingCommandFlag flagPart2 = flag('f', Component.text("ARG DESCRIPTION")) .withRequiredArg() - .argNamed(TranslatableComponent.of("piston.argument.flag")) + .argNamed(Component.translatable("piston.argument.flag")) .defaultsTo(ImmutableList.of("DEFAULT")) .ofTypes(ImmutableList.of(string_Key)) .build(); - private final ArgAcceptingCommandFlag flagPart3 = flag('f', TextComponent.of("ARG DESCRIPTION")) + private final ArgAcceptingCommandFlag flagPart3 = flag('f', Component.text("ARG DESCRIPTION")) .withRequiredArg() - .argNamed(TranslatableComponent.of("piston.argument.ARG NAME")) + .argNamed(Component.translatable("piston.argument.ARG NAME")) .defaultsTo(ImmutableList.of("DEFAULT")) .ofTypes(ImmutableList.of(string_Key)) .build(); @@ -92,19 +91,19 @@ public FlagsRegistration listeners(Collection listeners) { public void build() { commandManager.register("booleanFlag", b -> { b.aliases(ImmutableList.of()); - b.description(TextComponent.of("DESCRIPTION")); + b.description(Component.text("DESCRIPTION")); b.parts(ImmutableList.of(flagPart)); b.action(this::cmd$booleanFlag); }); commandManager.register("stringArgFlag", b -> { b.aliases(ImmutableList.of()); - b.description(TextComponent.of("DESCRIPTION")); + b.description(Component.text("DESCRIPTION")); b.parts(ImmutableList.of(flagPart2)); b.action(this::cmd$stringArgFlag); }); commandManager.register("stringArgFlagCustom", b -> { b.aliases(ImmutableList.of()); - b.description(TextComponent.of("DESCRIPTION")); + b.description(Component.text("DESCRIPTION")); b.parts(ImmutableList.of(flagPart3)); b.action(this::cmd$stringArgFlagCustom); }); diff --git a/core-ap/processor/src/test/resources/gen/IntArgRegistration.java b/core-ap/processor/src/test/resources/gen/IntArgRegistration.java index c99123c..f1b3d94 100644 --- a/core-ap/processor/src/test/resources/gen/IntArgRegistration.java +++ b/core-ap/processor/src/test/resources/gen/IntArgRegistration.java @@ -37,8 +37,7 @@ import java.lang.reflect.Method; import java.util.Collection; import java.util.List; -import net.kyori.adventure.text.TextComponent; -import net.kyori.adventure.text.TranslatableComponent; +import net.kyori.adventure.text.Component; import org.enginehub.piston.CommandManager; import org.enginehub.piston.CommandParameters; import org.enginehub.piston.gen.CommandCallListener; @@ -77,27 +76,27 @@ Annotation a(@InjectDelta(qux = 45, baz = 32, thq = { 10, 99 }) Object ah) { private ImmutableList listeners; - private final CommandArgument argPart = arg(TranslatableComponent.of("piston.argument.arg"), TextComponent.of("ARG DESCRIPTION")) + private final CommandArgument argPart = arg(Component.translatable("piston.argument.arg"), Component.text("ARG DESCRIPTION")) .defaultsTo(ImmutableList.of()) .ofTypes(ImmutableList.of(integer_Key)) .build(); - private final CommandArgument argPart2 = arg(TranslatableComponent.of("piston.argument.arg"), TextComponent.of("ARG DESCRIPTION")) + private final CommandArgument argPart2 = arg(Component.translatable("piston.argument.arg"), Component.text("ARG DESCRIPTION")) .defaultsTo(ImmutableList.of()) .ofTypes(ImmutableList.of(integer_injectGamma_something_to_match__Key)) .build(); - private final CommandArgument deltaPart = arg(TranslatableComponent.of("piston.argument.delta"), TextComponent.of("ARG DESCRIPTION")) + private final CommandArgument deltaPart = arg(Component.translatable("piston.argument.delta"), Component.text("ARG DESCRIPTION")) .defaultsTo(ImmutableList.of()) .ofTypes(ImmutableList.of(integer_injectDeltaQux45$Baz32$Thq1099_Key)) .build(); - private final CommandArgument alphaPart = arg(TranslatableComponent.of("piston.argument.alpha"), TextComponent.of("ARG DESCRIPTION")) + private final CommandArgument alphaPart = arg(Component.translatable("piston.argument.alpha"), Component.text("ARG DESCRIPTION")) .defaultsTo(ImmutableList.of()) .ofTypes(ImmutableList.of(integer_injectAlpha_Key)) .build(); - private final CommandArgument argPart3 = arg(TranslatableComponent.of("piston.argument.args"), TextComponent.of("ARG DESCRIPTION")) + private final CommandArgument argPart3 = arg(Component.translatable("piston.argument.args"), Component.text("ARG DESCRIPTION")) .defaultsTo(ImmutableList.of()) .ofTypes(ImmutableList.of(integer_Key)) .variable(true) @@ -129,31 +128,31 @@ public IntArgRegistration listeners(Collection listeners) { public void build() { commandManager.register("intArgument", b -> { b.aliases(ImmutableList.of()); - b.description(TextComponent.of("DESCRIPTION")); + b.description(Component.text("DESCRIPTION")); b.parts(ImmutableList.of(argPart)); b.action(this::cmd$intArgument); }); commandManager.register("annotatedIntArgument", b -> { b.aliases(ImmutableList.of()); - b.description(TextComponent.of("DESCRIPTION")); + b.description(Component.text("DESCRIPTION")); b.parts(ImmutableList.of(argPart2)); b.action(this::cmd$annotatedIntArgument); }); commandManager.register("annotatedIntArgument2", b -> { b.aliases(ImmutableList.of()); - b.description(TextComponent.of("DESCRIPTION")); + b.description(Component.text("DESCRIPTION")); b.parts(ImmutableList.of(deltaPart)); b.action(this::cmd$annotatedIntArgument2); }); commandManager.register("annotatedIntArgument3", b -> { b.aliases(ImmutableList.of()); - b.description(TextComponent.of("DESCRIPTION")); + b.description(Component.text("DESCRIPTION")); b.parts(ImmutableList.of(alphaPart)); b.action(this::cmd$annotatedIntArgument3); }); commandManager.register("variableIntArgument", b -> { b.aliases(ImmutableList.of()); - b.description(TextComponent.of("DESCRIPTION")); + b.description(Component.text("DESCRIPTION")); b.parts(ImmutableList.of(argPart3)); b.action(this::cmd$variableIntArgument); }); diff --git a/core-ap/processor/src/test/resources/gen/NoArgRegistration.java b/core-ap/processor/src/test/resources/gen/NoArgRegistration.java index f404237..5253d1e 100644 --- a/core-ap/processor/src/test/resources/gen/NoArgRegistration.java +++ b/core-ap/processor/src/test/resources/gen/NoArgRegistration.java @@ -32,7 +32,7 @@ import java.lang.Throwable; import java.lang.reflect.Method; import java.util.Collection; -import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.Component; import org.enginehub.piston.Command; import org.enginehub.piston.CommandManager; import org.enginehub.piston.CommandParameters; @@ -81,20 +81,20 @@ public NoArgRegistration listeners(Collection listeners) { public void build() { commandManager.register("noArgument", b -> { b.aliases(ImmutableList.of()); - b.description(TextComponent.of("DESCRIPTION")); + b.description(Component.text("DESCRIPTION")); b.parts(ImmutableList.of()); b.action(this::cmd$noArgument); }); commandManager.register("noArgumentFooter", b -> { b.aliases(ImmutableList.of()); - b.description(TextComponent.of("DESCRIPTION")); - b.footer(TextComponent.of("DESC FOOTER")); + b.description(Component.text("DESCRIPTION")); + b.footer(Component.text("DESC FOOTER")); b.parts(ImmutableList.of()); b.action(this::cmd$noArgumentFooter); }); commandManager.register("noArgumentCondition", b -> { b.aliases(ImmutableList.of()); - b.description(TextComponent.of("DESCRIPTION")); + b.description(Component.text("DESCRIPTION")); b.parts(ImmutableList.of()); b.action(this::cmd$noArgumentCondition); Method commandMethod = getCommandMethod(NoArg.class, "noArgCondition"); @@ -103,7 +103,7 @@ public void build() { }); commandManager.register("noArgumentStatic", b -> { b.aliases(ImmutableList.of()); - b.description(TextComponent.of("DESCRIPTION")); + b.description(Component.text("DESCRIPTION")); b.parts(ImmutableList.of()); b.action(this::cmd$noArgumentStatic); }); diff --git a/core-ap/processor/src/test/resources/gen/NonArgParametersRegistration.java b/core-ap/processor/src/test/resources/gen/NonArgParametersRegistration.java index f26ac12..ab09ec9 100644 --- a/core-ap/processor/src/test/resources/gen/NonArgParametersRegistration.java +++ b/core-ap/processor/src/test/resources/gen/NonArgParametersRegistration.java @@ -34,7 +34,7 @@ import java.lang.reflect.Method; import java.util.Collection; import java.util.concurrent.Callable; -import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.Component; import org.enginehub.piston.CommandManager; import org.enginehub.piston.CommandParameters; import org.enginehub.piston.gen.CommandCallListener; @@ -77,13 +77,13 @@ public NonArgParametersRegistration listeners(Collection li public void build() { commandManager.register("nonArgCommandParameters", b -> { b.aliases(ImmutableList.of()); - b.description(TextComponent.of("DESCRIPTION")); + b.description(Component.text("DESCRIPTION")); b.parts(ImmutableList.of()); b.action(this::cmd$nonArgCommandParameters); }); commandManager.register("nonArgInjected", b -> { b.aliases(ImmutableList.of()); - b.description(TextComponent.of("DESCRIPTION")); + b.description(Component.text("DESCRIPTION")); b.parts(ImmutableList.of()); b.action(this::cmd$nonArgInjected); }); diff --git a/core-ap/processor/src/test/resources/gen/Outer_BasicNestedRegistration.java b/core-ap/processor/src/test/resources/gen/Outer_BasicNestedRegistration.java index fcf228e..52372c4 100644 --- a/core-ap/processor/src/test/resources/gen/Outer_BasicNestedRegistration.java +++ b/core-ap/processor/src/test/resources/gen/Outer_BasicNestedRegistration.java @@ -32,7 +32,7 @@ import java.lang.Throwable; import java.lang.reflect.Method; import java.util.Collection; -import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.Component; import org.enginehub.piston.CommandManager; import org.enginehub.piston.CommandParameters; import org.enginehub.piston.gen.CommandCallListener; @@ -71,7 +71,7 @@ public Outer_BasicNestedRegistration listeners(Collection l public void build() { commandManager.register("noArgument", b -> { b.aliases(ImmutableList.of()); - b.description(TextComponent.of("DESCRIPTION")); + b.description(Component.text("DESCRIPTION")); b.parts(ImmutableList.of()); b.action(this::cmd$noArgument); }); diff --git a/core/src/main/java/org/enginehub/piston/config/ColorConfig.java b/core/src/main/java/org/enginehub/piston/config/ColorConfig.java index 7623285..65062df 100644 --- a/core/src/main/java/org/enginehub/piston/config/ColorConfig.java +++ b/core/src/main/java/org/enginehub/piston/config/ColorConfig.java @@ -94,7 +94,7 @@ public ColorConfig value(@Nullable TextColor value) { } public Component wrap(String text) { - return wrap(ImmutableList.of(TextComponent.of(text))); + return wrap(ImmutableList.of(Component.text(text))); } public Component wrap(Component... args) { @@ -117,7 +117,7 @@ private TextComponent.Builder renderFromArgs(List args) { TextColor color = getValue(); switch (args.size()) { case 0: - return TextComponent.builder("", color); + return Component.text().color(color); case 1: Component only = args.get(0); if (only instanceof TextComponent) { @@ -125,7 +125,7 @@ private TextComponent.Builder renderFromArgs(List args) { } // fall-through default: - return TextComponent.builder() + return Component.text() .color(color) .append(args); } diff --git a/core/src/main/java/org/enginehub/piston/config/Config.java b/core/src/main/java/org/enginehub/piston/config/Config.java index 33796e7..f716ce2 100644 --- a/core/src/main/java/org/enginehub/piston/config/Config.java +++ b/core/src/main/java/org/enginehub/piston/config/Config.java @@ -76,7 +76,7 @@ public Component value() { } protected Component wrapInternal(List args) { - return TranslatableComponent.of(key, args); + return Component.translatable(key, args); } protected abstract Component apply(TranslatableComponent placeholder); diff --git a/core/src/main/java/org/enginehub/piston/config/TextConfig.java b/core/src/main/java/org/enginehub/piston/config/TextConfig.java index b7babd1..dfc85db 100644 --- a/core/src/main/java/org/enginehub/piston/config/TextConfig.java +++ b/core/src/main/java/org/enginehub/piston/config/TextConfig.java @@ -19,8 +19,8 @@ package org.enginehub.piston.config; +import com.google.common.base.Strings; import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.TranslatableComponent; import javax.annotation.Nullable; @@ -69,7 +69,8 @@ protected void checkValue(@Nullable String value) { @Override protected Component apply(TranslatableComponent placeholder) { checkState(placeholder.args().isEmpty(), "TextConfig takes no arguments"); - return TextComponent.builder(getValue()) + return Component.text() + .content(Strings.nullToEmpty(getValue())) .mergeStyle(placeholder) .append(placeholder.children()) .build(); diff --git a/core/src/main/java/org/enginehub/piston/converter/SimpleArgumentConverter.java b/core/src/main/java/org/enginehub/piston/converter/SimpleArgumentConverter.java index 1a81428..0d619b8 100644 --- a/core/src/main/java/org/enginehub/piston/converter/SimpleArgumentConverter.java +++ b/core/src/main/java/org/enginehub/piston/converter/SimpleArgumentConverter.java @@ -20,7 +20,6 @@ package org.enginehub.piston.converter; import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.TextComponent; import org.enginehub.piston.inject.InjectedValueAccess; import java.util.List; @@ -32,7 +31,7 @@ public class SimpleArgumentConverter implements ArgumentConverter { public static SimpleArgumentConverter from(Converter converter, String description) { - return from(converter, TextComponent.of(description)); + return from(converter, Component.text(description)); } /** diff --git a/core/src/main/java/org/enginehub/piston/exception/CommandException.java b/core/src/main/java/org/enginehub/piston/exception/CommandException.java index 05289a7..d96c670 100644 --- a/core/src/main/java/org/enginehub/piston/exception/CommandException.java +++ b/core/src/main/java/org/enginehub/piston/exception/CommandException.java @@ -21,7 +21,6 @@ import com.google.common.collect.ImmutableList; import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.TextComponent; import org.enginehub.piston.Command; import org.enginehub.piston.util.TextHelper; @@ -33,7 +32,7 @@ public class CommandException extends RuntimeException { protected final ImmutableList commands; public CommandException(ImmutableList commands) { - this.message = TextComponent.empty(); + this.message = Component.empty(); this.commands = commands; } @@ -51,7 +50,7 @@ public CommandException(Component message, Throwable cause, ImmutableList commands) { super(cause); - this.message = TextComponent.empty(); + this.message = Component.empty(); this.commands = commands; } diff --git a/core/src/main/java/org/enginehub/piston/exception/ConditionFailedException.java b/core/src/main/java/org/enginehub/piston/exception/ConditionFailedException.java index d904150..26a1b80 100644 --- a/core/src/main/java/org/enginehub/piston/exception/ConditionFailedException.java +++ b/core/src/main/java/org/enginehub/piston/exception/ConditionFailedException.java @@ -21,13 +21,13 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; -import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.Component; import org.enginehub.piston.Command; public class ConditionFailedException extends CommandException { public ConditionFailedException(ImmutableList commands) { - super(TextComponent.of("Condition failed: " + Iterables.getLast(commands).getCondition()), + super(Component.text("Condition failed: " + Iterables.getLast(commands).getCondition()), commands); } diff --git a/core/src/main/java/org/enginehub/piston/exception/ConversionFailedException.java b/core/src/main/java/org/enginehub/piston/exception/ConversionFailedException.java index 34e8687..abc3018 100644 --- a/core/src/main/java/org/enginehub/piston/exception/ConversionFailedException.java +++ b/core/src/main/java/org/enginehub/piston/exception/ConversionFailedException.java @@ -36,14 +36,14 @@ public class ConversionFailedException extends UsageException { private static Component getMessage(Component conversionTarget, ArgumentConverter converter, FailedConversion conversion) { - TextComponent.Builder builder = TextComponent.builder("") - .append(TextComponent.of("Invalid value for ")) + TextComponent.Builder builder = Component.text() + .append(Component.text("Invalid value for ")) .append(conversionTarget); if (conversion.getError().getMessage() != null) { - builder.append(TextComponent.of(" (" + conversion.getError().getMessage() + ")")); + builder.append(Component.text(" (" + conversion.getError().getMessage() + ")")); } return builder - .append(TextComponent.of(", acceptable values are ")) + .append(Component.text(", acceptable values are ")) .append(converter.describeAcceptableArguments()) .build(); } diff --git a/core/src/main/java/org/enginehub/piston/exception/NoSuchCommandException.java b/core/src/main/java/org/enginehub/piston/exception/NoSuchCommandException.java index 257783a..fd492ba 100644 --- a/core/src/main/java/org/enginehub/piston/exception/NoSuchCommandException.java +++ b/core/src/main/java/org/enginehub/piston/exception/NoSuchCommandException.java @@ -20,14 +20,14 @@ package org.enginehub.piston.exception; import com.google.common.collect.ImmutableList; -import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.Component; public class NoSuchCommandException extends CommandException { private final String requestedCommand; public NoSuchCommandException(String requestedCommand) { - super(TextComponent.of("No such command: " + requestedCommand), ImmutableList.of()); + super(Component.text("No such command: " + requestedCommand), ImmutableList.of()); this.requestedCommand = requestedCommand; } diff --git a/core/src/main/java/org/enginehub/piston/exception/NoSuchFlagException.java b/core/src/main/java/org/enginehub/piston/exception/NoSuchFlagException.java index 67fffc6..111f667 100644 --- a/core/src/main/java/org/enginehub/piston/exception/NoSuchFlagException.java +++ b/core/src/main/java/org/enginehub/piston/exception/NoSuchFlagException.java @@ -41,16 +41,16 @@ private static String getAllFlags(ImmutableList commands) { } private static Component getMessage(CommandParseResult parseResult, char requestedFlag) { - TextComponent.Builder message = TextComponent.builder(""); - message.append(TextComponent.of("Flag '")) + TextComponent.Builder message = Component.text(); + message.append(Component.text("Flag '")) .append(ColorConfig.mainText().wrap(String.valueOf(requestedFlag))) - .append(TextComponent.of("' is not a valid flag for ")); + .append(Component.text("' is not a valid flag for ")); message.append(HelpGenerator.create(parseResult).getFullName()); String allFlags = getAllFlags(parseResult.getExecutionPath()); if (allFlags.isEmpty()) { - message.append(TextComponent.of(", as it does not have any flags")); + message.append(Component.text(", as it does not have any flags")); } else { - message.append(TextComponent.of(". Options: ")) + message.append(Component.text(". Options: ")) .append(ColorConfig.mainText().wrap(allFlags)); } return message.build(); diff --git a/core/src/main/java/org/enginehub/piston/part/ArgAcceptingCommandFlag.java b/core/src/main/java/org/enginehub/piston/part/ArgAcceptingCommandFlag.java index 737094e..5495ca5 100644 --- a/core/src/main/java/org/enginehub/piston/part/ArgAcceptingCommandFlag.java +++ b/core/src/main/java/org/enginehub/piston/part/ArgAcceptingCommandFlag.java @@ -22,7 +22,6 @@ import com.google.auto.value.AutoValue; import com.google.common.collect.ImmutableList; import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.TranslatableComponent; import org.enginehub.piston.config.ColorConfig; import org.enginehub.piston.inject.Key; @@ -50,7 +49,7 @@ public final Builder named(char name) { abstract Builder name(char name); public final Builder describedBy(String description) { - return describedBy(TextComponent.of(description)); + return describedBy(Component.text(description)); } public final Builder describedBy(Component description) { @@ -72,7 +71,7 @@ public final Builder ofTypes(Collection> types) { abstract Builder types(Collection> types); public final Builder argNamed(String name) { - return argNamed(TranslatableComponent.of(name)); + return argNamed(Component.translatable(name)); } public final Builder argNamed(TranslatableComponent name) { @@ -90,13 +89,13 @@ public final Builder argNamed(TranslatableComponent name) { @Override public Component getTextRepresentation() { return ColorConfig.partWrapping().wrap( - TextComponent.of("["), + Component.text("["), ColorConfig.mainText().wrap("-" + getName()), - TextComponent.space(), - TextComponent.of("<"), + Component.space(), + Component.text("<"), ColorConfig.mainText().wrap(getArgumentName()), - TextComponent.of(">"), - TextComponent.of("]") + Component.text(">"), + Component.text("]") ); } } diff --git a/core/src/main/java/org/enginehub/piston/part/CommandArgument.java b/core/src/main/java/org/enginehub/piston/part/CommandArgument.java index e922475..5c94ecb 100644 --- a/core/src/main/java/org/enginehub/piston/part/CommandArgument.java +++ b/core/src/main/java/org/enginehub/piston/part/CommandArgument.java @@ -23,7 +23,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.TranslatableComponent; import org.enginehub.piston.config.ColorConfig; import org.enginehub.piston.inject.Key; @@ -46,7 +45,7 @@ public static Builder builder(TranslatableComponent name, Component description) public abstract static class Builder { public final Builder named(String name) { - return named(TranslatableComponent.of(name)); + return named(Component.translatable(name)); } public final Builder named(TranslatableComponent name) { @@ -56,7 +55,7 @@ public final Builder named(TranslatableComponent name) { abstract Builder argumentName(TranslatableComponent name); public final Builder describedBy(String description) { - return describedBy(TextComponent.of(description)); + return describedBy(Component.text(description)); } public final Builder describedBy(Component description) { @@ -105,12 +104,12 @@ public final boolean isRequired() { @Override public Component getTextRepresentation() { ImmutableList.Builder builder = ImmutableList.builder(); - builder.add(TextComponent.of(isRequired() ? "<" : "[")); + builder.add(Component.text(isRequired() ? "<" : "[")); builder.add(ColorConfig.mainText().wrap(getArgumentName())); if (isVariable()) { builder.add(ColorConfig.textModifier().wrap("...")); } - builder.add(TextComponent.of(isRequired() ? ">" : "]")); + builder.add(Component.text(isRequired() ? ">" : "]")); return ColorConfig.partWrapping().wrap(builder.build()); } diff --git a/core/src/main/java/org/enginehub/piston/part/NoArgCommandFlag.java b/core/src/main/java/org/enginehub/piston/part/NoArgCommandFlag.java index aa28b5a..24a1c60 100644 --- a/core/src/main/java/org/enginehub/piston/part/NoArgCommandFlag.java +++ b/core/src/main/java/org/enginehub/piston/part/NoArgCommandFlag.java @@ -21,7 +21,6 @@ import com.google.auto.value.AutoValue; import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.TextComponent; import org.enginehub.piston.config.ColorConfig; @AutoValue @@ -29,7 +28,7 @@ public abstract class NoArgCommandFlag implements CommandFlag { public static NoArgCommandFlag.Builder builder(char name, String description) { - return builder(name, TextComponent.of(description)); + return builder(name, Component.text(description)); } public static NoArgCommandFlag.Builder builder(char name, @@ -49,7 +48,7 @@ public final Builder named(char name) { abstract Builder name(char name); public final Builder describedBy(String description) { - return describedBy(TextComponent.of(description)); + return describedBy(Component.text(description)); } public final Builder describedBy(Component description) { @@ -76,9 +75,9 @@ public final ArgAcceptingCommandFlag.Builder withRequiredArg() { @Override public Component getTextRepresentation() { return ColorConfig.partWrapping().wrap( - TextComponent.of("["), + Component.text("["), ColorConfig.mainText().wrap("-" + getName()), - TextComponent.of("]") + Component.text("]") ); } } diff --git a/core/src/main/java/org/enginehub/piston/part/SubCommandPart.java b/core/src/main/java/org/enginehub/piston/part/SubCommandPart.java index d284986..478e9ec 100644 --- a/core/src/main/java/org/enginehub/piston/part/SubCommandPart.java +++ b/core/src/main/java/org/enginehub/piston/part/SubCommandPart.java @@ -22,7 +22,6 @@ import com.google.auto.value.AutoValue; import com.google.common.collect.ImmutableList; import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.TranslatableComponent; import org.enginehub.piston.Command; import org.enginehub.piston.config.ColorConfig; @@ -50,7 +49,7 @@ public final Builder named(TranslatableComponent name) { abstract Builder argumentName(TranslatableComponent name); public final Builder describedBy(String description) { - return describedBy(TextComponent.of(description)); + return describedBy(Component.text(description)); } public final Builder describedBy(Component description) { @@ -83,13 +82,13 @@ public final Builder optional() { @Override public Component getTextRepresentation() { ImmutableList.Builder builder = ImmutableList.builder(); - builder.add(TextComponent.of(isRequired() ? "<" : "[")); + builder.add(Component.text(isRequired() ? "<" : "[")); builder.addAll(getCommands().stream() .map(Command::getName) .map(ColorConfig.mainText()::wrap) .collect(joiningWithBar()) .children()); - builder.add(TextComponent.of(isRequired() ? ">" : "]")); + builder.add(Component.text(isRequired() ? ">" : "]")); return ColorConfig.partWrapping().wrap(builder.build()); } diff --git a/core/src/main/java/org/enginehub/piston/util/ComponentHelper.java b/core/src/main/java/org/enginehub/piston/util/ComponentHelper.java index 15e0f9e..ff3fab1 100644 --- a/core/src/main/java/org/enginehub/piston/util/ComponentHelper.java +++ b/core/src/main/java/org/enginehub/piston/util/ComponentHelper.java @@ -34,9 +34,9 @@ public class ComponentHelper { */ public static Collector joiningWithBar() { return joiningTexts( - TextComponent.empty(), + Component.empty(), ColorConfig.partWrapping().wrap("|"), - TextComponent.empty() + Component.empty() ); } @@ -69,7 +69,7 @@ private ComponentJoiner(Component prefix, Component delimiter, Component suffix) private TextComponent.Builder initBuilder() { if (value == null) { - value = TextComponent.builder(""); + value = Component.text(); } else { value.append(delimiter); } @@ -94,7 +94,7 @@ public Component finish() { } return initBuilder().append(prefix).append(suffix).build(); } - return TextComponent.builder("") + return Component.text() .append(prefix) .append(value.build().children()) .append(suffix) diff --git a/core/src/main/java/org/enginehub/piston/util/HelpGenerator.java b/core/src/main/java/org/enginehub/piston/util/HelpGenerator.java index f931e39..af356c6 100644 --- a/core/src/main/java/org/enginehub/piston/util/HelpGenerator.java +++ b/core/src/main/java/org/enginehub/piston/util/HelpGenerator.java @@ -42,9 +42,6 @@ import java.util.List; import java.util.stream.Collectors; -import static net.kyori.adventure.text.TextComponent.newline; -import static net.kyori.adventure.text.TextComponent.space; - public class HelpGenerator { public static HelpGenerator create(Iterable commands) { @@ -83,7 +80,7 @@ private HelpGenerator(CommandParseResult parseResult) { * Generate a name for the set of commands as a whole. */ public Component getFullName() { - TextComponent.Builder usage = TextComponent.builder(); + TextComponent.Builder usage = Component.text(); String name = parseResult.getExecutionPath().get(0).getName(); CommandMetadata metadata = parseResult.getParameters().getMetadata(); @@ -92,11 +89,11 @@ public Component getFullName() { } usage.append(ColorConfig.mainText().wrap( TextConfig.commandPrefixValue(), - TextComponent.of(name) + Component.text(name) )); for (String input : parseResult.getOriginalArguments()) { - usage.append(space()); + usage.append(Component.space()); usage.append(ColorConfig.mainText().wrap(input)); } @@ -107,7 +104,7 @@ public Component getFullName() { * Generate a usage help text. */ public Component getUsage() { - TextComponent.Builder usage = TextComponent.builder() + TextComponent.Builder usage = Component.text() .append(ColorConfig.mainText().wrap( TextConfig.commandPrefixValue() )); @@ -138,12 +135,12 @@ public Component getUsage() { } // append a space before parts, if needed if (!reducedParts.isEmpty()) { - usage.append(space()); + usage.append(Component.space()); } PartHelper.appendUsage(reducedParts.stream(), usage); // append a space after parts/command, if needed if (iterator.hasNext()) { - usage.append(space()); + usage.append(Component.space()); } } @@ -156,7 +153,7 @@ public Component getFullHelp() { builder.add(primary.getDescription()); - builder.add(TextComponent.of("\nUsage: ")); + builder.add(Component.text("\nUsage: ")); builder.add(getUsage()); @@ -164,7 +161,7 @@ public Component getFullHelp() { appendFlags(builder); - primary.getFooter().ifPresent(footer -> builder.add(newline()).add(footer)); + primary.getFooter().ifPresent(footer -> builder.add(Component.newline()).add(footer)); return ColorConfig.helpText().wrap(builder.build()); } @@ -176,16 +173,16 @@ private void appendArguments(ImmutableList.Builder builder) { .map(x -> (CommandArgument) x) .collect(Collectors.toList()); if (args.size() > 0) { - builder.add(newline()); - builder.add(TextComponent.of("Arguments:\n")); + builder.add(Component.newline()); + builder.add(Component.text("Arguments:\n")); for (Iterator iterator = args.iterator(); iterator.hasNext(); ) { CommandArgument arg = iterator.next(); - builder.add(TextComponent.of(" ")).add(arg.getTextRepresentation()); + builder.add(Component.text(" ")).add(arg.getTextRepresentation()); addDefaultInfo(builder, arg); - builder.add(TextComponent.of(": ")) + builder.add(Component.text(": ")) .add(arg.getDescription()); if (iterator.hasNext()) { - builder.add(newline()); + builder.add(Component.newline()); } } } @@ -198,8 +195,8 @@ private void appendFlags(ImmutableList.Builder builder) { .map(x -> (CommandFlag) x) .collect(Collectors.toList()); if (flags.size() > 0) { - builder.add(newline()); - builder.add(TextComponent.of("Flags:\n")); + builder.add(Component.newline()); + builder.add(Component.text("Flags:\n")); for (Iterator iterator = flags.iterator(); iterator.hasNext(); ) { CommandFlag flag = iterator.next(); // produces text like "-f: Some description" @@ -207,10 +204,10 @@ private void appendFlags(ImmutableList.Builder builder) { if (flag instanceof ArgAcceptingCommandFlag) { addDefaultInfo(builder, (ArgAcceptingCommandFlag) flag); } - builder.add(TextComponent.of(": ")) + builder.add(Component.text(": ")) .add(flag.getDescription()); if (iterator.hasNext()) { - builder.add(newline()); + builder.add(Component.newline()); } } } @@ -220,7 +217,7 @@ private void addDefaultInfo(ImmutableList.Builder builder, ArgAccepti if (arg.getDefaults().isEmpty()) { return; } - builder.add(TextComponent.of(" (defaults to ")); + builder.add(Component.text(" (defaults to ")); String value; if (arg.getDefaults().size() == 1) { value = arg.getDefaults().get(0); @@ -232,8 +229,8 @@ private void addDefaultInfo(ImmutableList.Builder builder, ArgAccepti .filter(s -> s.trim().length() > 0) .collect(Collectors.joining(", ", "[", "]")); } - builder.add(TextComponent.of(value)); - builder.add(TextComponent.of(")")); + builder.add(Component.text(value)); + builder.add(Component.text(")")); } } diff --git a/core/src/main/java/org/enginehub/piston/util/PartHelper.java b/core/src/main/java/org/enginehub/piston/util/PartHelper.java index fa85cc7..70d70e1 100644 --- a/core/src/main/java/org/enginehub/piston/util/PartHelper.java +++ b/core/src/main/java/org/enginehub/piston/util/PartHelper.java @@ -74,9 +74,9 @@ public static void appendUsage(Stream parts, TextComponent.Builder .map(String::valueOf) .collect(Collectors.joining(""))) .map(text -> ColorConfig.partWrapping().wrap( - TextComponent.of("["), + Component.text("["), ColorConfig.mainText().wrap("-" + text), - TextComponent.of("]") + Component.text("]") )) .map(Stream::of).orElse(Stream.empty()); @@ -88,7 +88,7 @@ public static void appendUsage(Stream parts, TextComponent.Builder while (usages.hasNext()) { output.append(usages.next()); if (usages.hasNext()) { - output.append(TextComponent.of(" ")); + output.append(Component.text(" ")); } } } @@ -96,18 +96,18 @@ public static void appendUsage(Stream parts, TextComponent.Builder private static Stream buildOptionalMerging(SubCommandPart optionalSubCommand, Stream postComponents) { return Stream.of(ColorConfig.partWrapping().wrap( - TextComponent.of("<"), + Component.text("<"), optionalSubCommand.getCommands().stream() .map(Command::getName) .map(ColorConfig.mainText()::wrap) .collect(ComponentHelper.joiningWithBar()), - TextComponent.of("|"), + Component.text("|"), postComponents.collect(ComponentHelper.joiningTexts( - TextComponent.empty(), - TextComponent.of(" "), - TextComponent.empty() + Component.empty(), + Component.text(" "), + Component.empty() )), - TextComponent.of(">") + Component.text(">") )); } diff --git a/core/src/test/java/org/enginehub/piston/config/ConfigHolderTest.java b/core/src/test/java/org/enginehub/piston/config/ConfigHolderTest.java index 26f6e39..e0992f5 100644 --- a/core/src/test/java/org/enginehub/piston/config/ConfigHolderTest.java +++ b/core/src/test/java/org/enginehub/piston/config/ConfigHolderTest.java @@ -22,7 +22,6 @@ import com.google.common.collect.ImmutableList; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; -import net.kyori.adventure.text.TranslatableComponent; import net.kyori.adventure.text.format.NamedTextColor; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; @@ -54,7 +53,7 @@ private TestCase(String name, Component input, Component expected) { private final ConfigHolder holder = ConfigHolder.create(); private final Component inputWithStyles = ColorConfig.helpText() .wrap(TextConfig.commandPrefixValue()); - private final TextComponent outputStyled = TextComponent.of("prefix!", NamedTextColor.DARK_PURPLE); + private final TextComponent outputStyled = Component.text("prefix!", NamedTextColor.DARK_PURPLE); @BeforeEach void setUp() { @@ -67,11 +66,11 @@ void setUp() { Stream test() { List testCases = ImmutableList.of( new TestCase("Translatable", - TranslatableComponent.of("test", inputWithStyles), - TranslatableComponent.of("test", outputStyled)), + Component.translatable("test", inputWithStyles), + Component.translatable("test", outputStyled)), new TestCase("Text", - TextComponent.of("test").append(inputWithStyles), - TextComponent.of("test").append(outputStyled)) + Component.text("test").append(inputWithStyles), + Component.text("test").append(outputStyled)) ); return testCases.stream().map(testCase -> diff --git a/core/src/test/java/org/enginehub/piston/exception/ConstructionTest.java b/core/src/test/java/org/enginehub/piston/exception/ConstructionTest.java index 685bb8b..5f8272a 100644 --- a/core/src/test/java/org/enginehub/piston/exception/ConstructionTest.java +++ b/core/src/test/java/org/enginehub/piston/exception/ConstructionTest.java @@ -21,7 +21,6 @@ import com.google.common.collect.ImmutableList; import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.TextComponent; import org.enginehub.piston.Command; import org.enginehub.piston.CommandParseResult; import org.enginehub.piston.NoInputCommandParameters; @@ -62,7 +61,7 @@ void commandExecutionException() { @Test void stopExecutionException() { - Component message = TextComponent.of("stop"); + Component message = Component.text("stop"); ImmutableList commands = ImmutableList.of(mock(Command.class)); StopExecutionException ex = new StopExecutionException(message, commands); assertSame(message, ex.getRichMessage()); @@ -72,7 +71,7 @@ void stopExecutionException() { @Test void stopExecutionExceptionNoCommands() { - Component message = TextComponent.of("stop"); + Component message = Component.text("stop"); StopExecutionException ex = new StopExecutionException(message); assertSame(message, ex.getRichMessage()); assertEquals("stop", ex.getMessage()); @@ -111,7 +110,7 @@ void noSuchFlagExceptionNoFlags() { void noSuchFlagExceptionWrongFlag() { CommandParseResult mock = mock(CommandParseResult.class); ImmutableList executionPath = mockExecutionPath(ImmutableList.of( - CommandParts.flag('q', TextComponent.of("q flag")).build() + CommandParts.flag('q', Component.text("q flag")).build() )); when(mock.getExecutionPath()).thenReturn(executionPath); when(mock.getParameters()).thenReturn(NoInputCommandParameters.builder().build()); @@ -131,7 +130,7 @@ void usageExceptionNoMessage() { UsageException ex = new UsageException(mock); assertSame(executionPath, ex.getCommands()); assertSame(mock, ex.getCommandParseResult()); - assertEquals(TextComponent.empty(), ex.getRichMessage()); + assertEquals(Component.empty(), ex.getRichMessage()); assertNull(ex.getMessage()); } @@ -141,7 +140,7 @@ void usageExceptionMessage() { ImmutableList executionPath = mockExecutionPath(ImmutableList.of()); when(mock.getExecutionPath()).thenReturn(executionPath); when(mock.getParameters()).thenReturn(NoInputCommandParameters.builder().build()); - Component message = TextComponent.of("message"); + Component message = Component.text("message"); UsageException ex = new UsageException(message, mock); assertSame(executionPath, ex.getCommands()); assertSame(mock, ex.getCommandParseResult()); @@ -155,7 +154,7 @@ void usageExceptionMessageCause() { ImmutableList executionPath = mockExecutionPath(ImmutableList.of()); when(mock.getExecutionPath()).thenReturn(executionPath); when(mock.getParameters()).thenReturn(NoInputCommandParameters.builder().build()); - Component message = TextComponent.of("message"); + Component message = Component.text("message"); Throwable cause = new Throwable(); UsageException ex = new UsageException(message, cause, mock); assertSame(executionPath, ex.getCommands()); @@ -175,7 +174,7 @@ void usageExceptionCause() { UsageException ex = new UsageException(cause, mock); assertSame(executionPath, ex.getCommands()); assertSame(mock, ex.getCommandParseResult()); - assertEquals(TextComponent.empty(), ex.getRichMessage()); + assertEquals(Component.empty(), ex.getRichMessage()); assertEquals(cause.getClass().getName(), ex.getMessage()); assertSame(cause, ex.getCause()); } diff --git a/default-impl/src/main/java/org/enginehub/piston/impl/CommandParser.java b/default-impl/src/main/java/org/enginehub/piston/impl/CommandParser.java index 57138c2..2f86f81 100644 --- a/default-impl/src/main/java/org/enginehub/piston/impl/CommandParser.java +++ b/default-impl/src/main/java/org/enginehub/piston/impl/CommandParser.java @@ -65,6 +65,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; import static java.util.Objects.requireNonNull; +import static net.kyori.adventure.text.Component.text; class CommandParser { @@ -167,11 +168,11 @@ private UsageException usageException(Component message) { } private UsageException notEnoughArgumentsException() { - return usageException(TextComponent.of("Not enough arguments.")); + return usageException(text("Not enough arguments.")); } private UsageException tooManyArgumentsException() { - return usageException(TextComponent.of("Too many arguments.")); + return usageException(text("Too many arguments.")); } private ConversionFailedException conversionFailedException(ArgAcceptingCommandPart nextArg, String token) { @@ -301,14 +302,15 @@ private void finalizeCommand() { if (requiredIter.hasNext()) { ArgConsumingCommandPart missing = requiredIter.next(); if (missing instanceof CommandArgument) { - throw usageException(TextComponent.builder("Missing argument for ") + throw usageException(text() + .content("Missing argument for ") .append(missing.getTextRepresentation()) - .append(TextComponent.of(".")) + .append(text(".")) .build()); } else { checkState(missing instanceof SubCommandPart, "Unknown part interface: %s", missing.getClass()); - throw usageException(TextComponent.of("No sub-command provided. Options: " + throw usageException(text("No sub-command provided. Options: " + ((SubCommandPart) missing).getCommands().stream() .distinct() .map(Command::getName) @@ -383,17 +385,17 @@ private boolean parseSubCommand(SubCommandPart part, String token) { } private TextComponent invalidSubCommandMessage(String token, ImmutableMap subCommands) { - return TextComponent.builder() - .append("Invalid sub-command '") + return text() + .append(text("Invalid sub-command '")) .append(ColorConfig.mainText().wrap(token)) - .append("'. Options: ") + .append(text("'. Options: ")) .append(subCommands.values().stream().distinct() .map(Command::getName) .map(ColorConfig.mainText()::wrap) .collect(ComponentHelper.joiningTexts( - TextComponent.empty(), - TextComponent.of(", "), - TextComponent.empty() + Component.empty(), + text(", "), + Component.empty() ))) .build(); } @@ -506,15 +508,16 @@ private void parseFlags(String flags) { throw new NoSuchFlagException(getResult(), c); } if (seenFlags.contains(flag)) { - throw usageException(TextComponent.builder("Flag ") + throw usageException(Component.text() + .content("Flag ") .append(flag.getTextRepresentation()) - .append(" has already been specified.") + .append(text(" has already been specified.")) .build()); } if (flag instanceof ArgAcceptingCommandFlag) { if (i + 1 < flags.length()) { // Only allow argument-flags at the end of flag-combos. - throw usageException(TextComponent.of("Argument-accepting flags must be " + + throw usageException(text("Argument-accepting flags must be " + "at the end of combined flag groups.")); } bind(flag); diff --git a/default-impl/src/test/java/org/enginehub/piston/impl/CommandManagerTest.java b/default-impl/src/test/java/org/enginehub/piston/impl/CommandManagerTest.java index 6a88d2c..1e97b41 100644 --- a/default-impl/src/test/java/org/enginehub/piston/impl/CommandManagerTest.java +++ b/default-impl/src/test/java/org/enginehub/piston/impl/CommandManagerTest.java @@ -20,8 +20,7 @@ package org.enginehub.piston.impl; import com.google.common.collect.ImmutableList; -import net.kyori.adventure.text.TextComponent; -import net.kyori.adventure.text.TranslatableComponent; +import net.kyori.adventure.text.Component; import org.enginehub.piston.Command; import org.enginehub.piston.CommandManager; import org.enginehub.piston.exception.ConditionFailedException; @@ -40,7 +39,7 @@ public class CommandManagerTest { void parseFailsOnRootConditionUnsatisfied() { CommandManager manager = new CommandManagerImpl(); manager.register("test", cmd -> { - cmd.description(TextComponent.of("Test")) + cmd.description(Component.text("Test")) .condition(Command.Condition.FALSE); }); @@ -55,11 +54,11 @@ void parseFailsOnSubConditionUnsatisfied() { CommandManager manager = new CommandManagerImpl(); manager.register("test", cmd -> { Command sub = manager.newCommand("sub") - .description(TextComponent.of("Sub")) + .description(Component.text("Sub")) .condition(Command.Condition.FALSE) .build(); - cmd.description(TextComponent.of("Test")) - .addPart(SubCommandPart.builder(TranslatableComponent.of("actions"), TextComponent.of("Sub-actions")) + cmd.description(Component.text("Test")) + .addPart(SubCommandPart.builder(Component.translatable("actions"), Component.text("Sub-actions")) .required() .withCommands(ImmutableList.of(sub)) .build()); From 390fac85e7d56b1883995fed0edc63243d8e4ec7 Mon Sep 17 00:00:00 2001 From: Joo200 Date: Mon, 14 Aug 2023 15:41:46 +0200 Subject: [PATCH 4/7] Updated gradle wrapper, fixed compilation, removed old repo --- build.gradle.kts | 13 +++++-------- buildSrc/build.gradle.kts | 7 +++---- buildSrc/src/main/kotlin/Libs.kt | 2 +- buildSrc/src/main/kotlin/common.kt | 23 +++++++++++++---------- core-ap/processor/build.gradle.kts | 4 ++-- gradle/wrapper/gradle-wrapper.jar | Bin 58910 -> 59203 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 2 +- gradlew.bat | 21 +++------------------ 9 files changed, 29 insertions(+), 45 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 2ebe530..e92493d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,26 +6,23 @@ plugins { configureArtifactory() -repositories { - jcenter() -} - release { tagTemplate = "v\${version}" buildTasks = listOf() } val totalReport = tasks.register("jacocoTotalReport") { - subprojects.forEach { proj -> + for (proj in subprojects) { + proj.apply(plugin = "jacoco") proj.plugins.withId("java") { executionData( fileTree(proj.buildDir.absolutePath).include("**/jacoco/*.exec") ) sourceSets(proj.the().sourceSets["main"]) reports { - xml.isEnabled = true - xml.destination = rootProject.buildDir.resolve("reports/jacoco/report.xml") - html.isEnabled = true + xml.required.set(true) + xml.outputLocation.set(rootProject.buildDir.resolve("reports/jacoco/report.xml")) + html.required.set(true) } dependsOn(proj.tasks.named("test")) } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 13c0b6f..525f573 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -4,7 +4,6 @@ plugins { } repositories { - jcenter() gradlePluginPortal() maven { name = "EngineHub Repository" @@ -15,7 +14,7 @@ repositories { dependencies { implementation(gradleApi()) implementation(gradleKotlinDsl()) - implementation("org.enginehub.gradle:gradle-codecov-plugin:0.1.0-SNAPSHOT") - implementation("gradle.plugin.net.minecrell:licenser:0.4.1") - implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.13.0") + implementation("org.enginehub.gradle:gradle-codecov-plugin:0.1.0") + implementation("gradle.plugin.org.cadixdev.gradle:licenser:0.6.1") + implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.29.0") } diff --git a/buildSrc/src/main/kotlin/Libs.kt b/buildSrc/src/main/kotlin/Libs.kt index 06c9648..8aed8d8 100644 --- a/buildSrc/src/main/kotlin/Libs.kt +++ b/buildSrc/src/main/kotlin/Libs.kt @@ -18,6 +18,6 @@ object Libs { const val log4jApi = "org.apache.logging.log4j:log4j-api:$log4jVersion" const val log4jCore = "org.apache.logging.log4j:log4j-core:$log4jVersion" const val javaxAnnotations = "com.google.code.findbugs:jsr305:3.0.2" - const val compileTesting = "com.google.testing.compile:compile-testing:0.19" + const val compileTesting = "com.google.testing.compile:compile-testing:0.21.0" const val mockito = "org.mockito:mockito-core:3.8.0" } diff --git a/buildSrc/src/main/kotlin/common.kt b/buildSrc/src/main/kotlin/common.kt index 9fa3889..418943d 100644 --- a/buildSrc/src/main/kotlin/common.kt +++ b/buildSrc/src/main/kotlin/common.kt @@ -1,12 +1,9 @@ -import net.minecrell.gradle.licenser.LicenseExtension -import org.gradle.api.JavaVersion +import org.cadixdev.gradle.licenser.LicenseExtension import org.gradle.api.Project import org.gradle.api.plugins.JavaPluginExtension import org.gradle.api.publish.PublishingExtension import org.gradle.api.publish.maven.MavenPublication import org.gradle.api.tasks.Copy -import org.gradle.api.tasks.SourceSetContainer -import org.gradle.api.tasks.bundling.Jar import org.gradle.api.tasks.compile.JavaCompile import org.gradle.api.tasks.javadoc.Javadoc import org.gradle.api.tasks.testing.Test @@ -32,7 +29,7 @@ fun Project.applyCommonConfig( ) { apply(plugin = "java-library") apply(plugin = "java") - apply(plugin = "net.minecrell.licenser") + apply(plugin = "org.cadixdev.licenser") apply(plugin = "maven-publish") apply(plugin = "com.jfrog.artifactory") apply(plugin = "jacoco") @@ -40,9 +37,9 @@ fun Project.applyCommonConfig( project.group = group configure { - header = rootProject.file("HEADER.txt") - exclude("**/META-INF/**") - exclude("**/*.properties") + header(rootProject.file("HEADER.txt")) + include("**/*.java") + include("**/*.kt") } tasks.withType().configureEach { @@ -73,8 +70,14 @@ fun Project.applyCommonConfig( from(rootProject.file("common-test-resources")) } - configure { - toolchain.languageVersion.set(JavaLanguageVersion.of(8)) + tasks.withType { + sourceCompatibility = "1.8" + targetCompatibility = "1.8" + } + plugins.withId("java") { + the().toolchain { + languageVersion.set(JavaLanguageVersion.of(8)) + } } tasks.withType().configureEach { (options as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet") diff --git a/core-ap/processor/build.gradle.kts b/core-ap/processor/build.gradle.kts index 8de5f3f..9958549 100644 --- a/core-ap/processor/build.gradle.kts +++ b/core-ap/processor/build.gradle.kts @@ -2,8 +2,8 @@ import org.gradle.internal.jvm.Jvm import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - kotlin("jvm") version "1.4.31" - kotlin("kapt") version "1.4.31" + kotlin("jvm") version "1.9.0" + kotlin("kapt") version "1.9.0" } applyCoreApConfig() diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 62d4c053550b91381bbd28b1afc82d634bf73a8a..e708b1c023ec8b20f512888fe07c5bd3ff77bb8f 100644 GIT binary patch delta 6656 zcmY+Ibx_pN*Z*PZ4(U#j1qtbvrOTyO8fghZ8kYJfEe%U|$dV!@ASKczEZq$fg48M@ z;LnHO_j#Uq?%bL4dY^md%$$4Y+&@nKC|1uHR&59YNhubGh72|a#ylPdh9V+akp|I; zPk^W-a00GrFMkz_NSADdv2G2-i6rb=cB_@WnG(**4ZO$=96R=t|NZ@|0_z&q3GwO^ ziUFcuj$a9QaZ3j?xt`5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zd?lxFTyjN3mXnL!%#>Z%$0gJ4*9g;e;@zSmQ{eGGDaRRNM3s@6!;hYuVc=c+3B z=qzNNS~n^EsJU4aOGE|mdy={C^lPKEfPL-IJAsTpQsDgZ@~s+eHZYmp9yb=YW_4r?lqQaYZQ`nau){W`LY#P)>i zq^wHEuOYs#FlPZeMuT@Etb@~A6feCebq`miJE3w+gAL%bVF_s*5e*@)?xmKSo%I3? zLELHVdWia$}~s6 zr!^LfxSSB4Td&9iTXrzQpl5ZDo#SdmNr;23QsPHQ!x!UT9xtb!Ycz^JF8x)%cFOXK z^EXw%dRz_VD}7?RU^4{)1+xFO=z!EI8IUa3U*rag=1BpHX$Xi<__kSbS{y_xa*MJv z_`thq0Z^sPzjAk48ssDQj}!$N8Q$XC84(bU$t_Bm69Jf+C!h_}ep zwzpQj9sRA94<{x3{~z&ix-DwX;RAzka)4-#6ZHJqKh|SVuO|>Yrv+m30+!|sK<-|E z=)5E->#y<_1V|T1f%Af!ZYqXg}`O zI$qKOWdnclF`%_Z`WGOe{`A`l-#a?s=Q1a#@BOWmExH2;Wl`OB!B-%lq3nO{4=WO& z#k_x|N&(qzm*6S{G*|GCegF2N2ulC+(58z2DG~yUs}i8zvRf&$CJCaexJ6Xu!`qz( z)*v8*kAE#D0KCo*s{8^Rbg=`*E2MzeIt0|x55%n-gO&yX#$l=3W7-_~&(G8j1E(XB hw}tl`5K!1C(72%nnjQrp<7@!WCh47rWB+@R{{wClNUHz< diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 442d913..84a0b92 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index fbd7c51..4f906e0 100755 --- a/gradlew +++ b/gradlew @@ -130,7 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath diff --git a/gradlew.bat b/gradlew.bat index a9f778a..ac1b06f 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -54,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -64,21 +64,6 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line @@ -86,7 +71,7 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell From a589746bb8d38a068fc85b17ac8b2b0b5d82d7c9 Mon Sep 17 00:00:00 2001 From: Joo200 Date: Sun, 20 Aug 2023 22:12:07 +0200 Subject: [PATCH 5/7] Use Jetbrains annotation --- .../main/java/org/enginehub/piston/config/ConfigRenderer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/enginehub/piston/config/ConfigRenderer.java b/core/src/main/java/org/enginehub/piston/config/ConfigRenderer.java index 1c160e6..d63601d 100644 --- a/core/src/main/java/org/enginehub/piston/config/ConfigRenderer.java +++ b/core/src/main/java/org/enginehub/piston/config/ConfigRenderer.java @@ -23,7 +23,7 @@ import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TranslatableComponent; import net.kyori.adventure.text.renderer.ComponentRenderer; -import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.NotNull; import java.util.List; @@ -45,7 +45,7 @@ private ConfigRenderer() { } @Override - public @NonNull Component render(@NonNull Component component, @NonNull ConfigHolder context) { + public @NotNull Component render(@NotNull Component component, @NotNull ConfigHolder context) { component = replaceSubcomponents(component, context); if (component instanceof TranslatableComponent) { // check if replacing From a6ac2b005ee31f4ec24d781f429a033e9b60b1f0 Mon Sep 17 00:00:00 2001 From: Joo200 Date: Sun, 20 Aug 2023 22:15:23 +0200 Subject: [PATCH 6/7] git: ignore jetbrains ide files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 0f35681..23de33d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,6 @@ build/ libs/ *.log* + +# Jetbrains IDE +.idea From 95fa694c694d3cec2f85bcc14c718dca7ce788d4 Mon Sep 17 00:00:00 2001 From: Joo200 Date: Mon, 9 Oct 2023 12:43:13 +0200 Subject: [PATCH 7/7] Increase version to 0.6.0-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index e699728..b159a14 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ group=org.enginehub.piston -version=0.5.8-SNAPSHOT +version=0.6.0-SNAPSHOT