From 22b2564d539651968aa15126317bb6426c622d76 Mon Sep 17 00:00:00 2001 From: Octavia Togami Date: Tue, 11 Aug 2020 00:48:25 -0700 Subject: [PATCH] Move to Adventure --- buildSrc/src/main/kotlin/Libs.kt | 6 +++--- buildSrc/src/main/kotlin/common.kt | 7 +++++++ .../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 ++-- 50 files changed, 110 insertions(+), 108 deletions(-) diff --git a/buildSrc/src/main/kotlin/Libs.kt b/buildSrc/src/main/kotlin/Libs.kt index c7e8020..7c0ed06 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.0.0-SNAPSHOT" + 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.10" private const val autoValueVersion = "1.7.3" const val autoValueAnnotations = "com.google.auto.value:auto-value-annotations:$autoValueVersion" diff --git a/buildSrc/src/main/kotlin/common.kt b/buildSrc/src/main/kotlin/common.kt index 067ae85..26e1ac2 100644 --- a/buildSrc/src/main/kotlin/common.kt +++ b/buildSrc/src/main/kotlin/common.kt @@ -49,6 +49,13 @@ fun Project.applyCommonConfig( repositories { jcenter() + maven { + name = "Sonatype Snapshots" + url = uri("https://oss.sonatype.org/content/repositories/snapshots/") + mavenContent { + snapshotsOnly() + } + } } dependencies { 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 b6c2c09..323415b 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.enginehub.piston.Command; import org.enginehub.piston.CommandMetadata; import org.enginehub.piston.CommandParseResult; 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;