Skip to content

Commit

Permalink
Move to Adventure
Browse files Browse the repository at this point in the history
  • Loading branch information
octylFractal committed Aug 11, 2020
1 parent cccb64a commit 22b2564
Show file tree
Hide file tree
Showing 50 changed files with 110 additions and 108 deletions.
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/Libs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 7 additions & 0 deletions buildSrc/src/main/kotlin/common.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -180,4 +180,4 @@ class HelpGeneratorTest {
).fullName))
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -166,4 +166,4 @@ public void build() {
private String extract$flag3(CommandParameters parameters) {
return flagPart3.value(parameters).asSingle(string_Key);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -126,4 +126,4 @@ public void build() {
private Callable<Object> extract$injected(CommandParameters parameters) {
return requireOptional(callable$Object_Key, "injected", parameters.injectedValue(callable$Object_Key));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/enginehub/piston/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
19 changes: 10 additions & 9 deletions core/src/main/java/org/enginehub/piston/config/ColorConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -37,13 +38,13 @@
public class ColorConfig extends Config<TextColor> {

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<Style.Merge> MERGE_NO_COLOR = Style.Merge.of(
Style.Merge.DECORATIONS, Style.Merge.INSERTION, Style.Merge.EVENTS
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/org/enginehub/piston/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
Loading

0 comments on commit 22b2564

Please sign in to comment.