Skip to content

Commit

Permalink
Fix rebase issues
Browse files Browse the repository at this point in the history
Removes TypedBuilder
Rebump version due to new build file
Fix various new argument builders
  • Loading branch information
broccolai committed Mar 29, 2021
1 parent f0574de commit d73e711
Show file tree
Hide file tree
Showing 35 changed files with 35 additions and 123 deletions.
Empty file removed build.gradle
Empty file.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ gradle.taskGraph.whenReady {
}

group = "cloud.commandframework"
version = "1.5.0-SNAPSHOT"
version = "2.0.0-SNAPSHOT"
description = "Command framework and dispatcher for the JVM"

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ private Builder(
* @since 1.4.0
*/
public <T> @NonNull Builder<C> argument(
final CommandArgument.@NonNull Builder<C, T> builder,
final CommandArgument.@NonNull Builder<C, T, ?> builder,
final @NonNull ArgumentDescription description
) {
final List<CommandComponent<C>> commandComponents = new ArrayList<>(this.commandComponents);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ protected Builder(
* @return Builder instance
* @since 1.4.0
*/
public @NonNull Builder<@NonNull C, @NonNull T> withDefaultDescription(
public @NonNull Builder<@NonNull C, @NonNull T, @NonNull B> withDefaultDescription(
final @NonNull ArgumentDescription defaultDescription
) {
this.defaultDescription = Objects.requireNonNull(defaultDescription, "Default description may not be null");
Expand Down Expand Up @@ -752,92 +752,4 @@ protected final boolean isRequired() {

}

/**
* A variant of builders designed for subclassing, that returns a self type .
*
* @param <C> sender type
* @param <T> argument value type
* @param <B> the subclass type
* @since 1.5.0
*/
public abstract static class TypedBuilder<C, T, B extends Builder<C, T>> extends Builder<C, T> {

protected TypedBuilder(
final @NonNull TypeToken<T> valueType,
final @NonNull String name
) {
super(valueType, name);
}

protected TypedBuilder(
final @NonNull Class<T> valueType,
final @NonNull String name
) {
super(valueType, name);
}

@SuppressWarnings("unchecked")
protected final B self() {
return (B) this;
}

/**
* {@inheritDoc}
*/
@Override
public @NonNull B manager(final @NonNull CommandManager<C> manager) {
super.manager(manager);
return this.self();
}

/**
* {@inheritDoc}
*/
@Override
public @NonNull B asRequired() {
super.asRequired();
return this.self();
}

/**
* {@inheritDoc}
*/
@Override
public @NonNull B asOptional() {
super.asOptional();
return this.self();
}

/**
* {@inheritDoc}
*/
@Override
public @NonNull B asOptionalWithDefault(final @NonNull String defaultValue) {
super.asOptionalWithDefault(defaultValue);
return this.self();
}

/**
* {@inheritDoc}
*/
@Override
public @NonNull B withParser(final @NonNull ArgumentParser<@NonNull C, @NonNull T> parser) {
super.withParser(parser);
return this.self();
}

/**
* {@inheritDoc}
*/
@Override
public @NonNull Builder<@NonNull C, @NonNull T> withSuggestionsProvider(
final @NonNull BiFunction<@NonNull CommandContext<C>,
@NonNull String, @NonNull List<String>> suggestionsProvider
) {
super.withSuggestionsProvider(suggestionsProvider);
return this.self();
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public enum ParserMode {
}


public static final class Builder<C> extends CommandArgument.Builder<C, Role> {
public static final class Builder<C> extends CommandArgument.Builder<C, Role, Builder<C>> {

private Set<ParserMode> modes = new HashSet<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ public class MutableCommandBuilder<C : Any> {
@Suppress("DEPRECATION")
@Deprecated(message = "ArgumentDescription should be used over Description", level = DeprecationLevel.HIDDEN)
public fun argument(
argument: CommandArgument.Builder<C, *>,
argument: CommandArgument.Builder<C, *, *>,
description: Description = Description.empty()
): MutableCommandBuilder<C> =
mutate { it.argument(argument, description) }
Expand All @@ -547,7 +547,7 @@ public class MutableCommandBuilder<C : Any> {
* @since 1.4.0
*/
public fun argument(
argument: CommandArgument.Builder<C, *>,
argument: CommandArgument.Builder<C, *, *>,
description: ArgumentDescription = ArgumentDescription.empty()
): MutableCommandBuilder<C> =
mutate { it.argument(argument, description) }
Expand Down Expand Up @@ -692,7 +692,7 @@ public class MutableCommandBuilder<C : Any> {
name: String,
aliases: Array<String> = emptyArray(),
description: ArgumentDescription = ArgumentDescription.empty(),
argumentBuilder: CommandArgument.Builder<C, *>
argumentBuilder: CommandArgument.Builder<C, *, *>
): MutableCommandBuilder<C> = mutate {
it.flag(
this.commandManager.flagBuilder(name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private Location2DArgument(
}


public static final class Builder<C> extends CommandArgument.Builder<C, Location2D> {
public static final class Builder<C> extends CommandArgument.Builder<C, Location2D, Builder<C>> {

private Builder(
final @NonNull String name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public final class AngleArgument<C> extends CommandArgument<C, AngleArgumentType
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, AngleArgumentType.Angle, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, AngleArgumentType.Angle, Builder<C>> {

Builder(final @NonNull String name) {
super(AngleArgumentType.Angle.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public final class AxisArgument<C> extends CommandArgument<C, EnumSet<Direction.
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, EnumSet<Direction.Axis>, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, EnumSet<Direction.Axis>, Builder<C>> {

Builder(final @NonNull String name) {
super(TYPE, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public final class ColorArgument<C> extends CommandArgument<C, Formatting> {
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends CommandArgument.TypedBuilder<C, Formatting, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, Formatting, Builder<C>> {

Builder(final @NonNull String name) {
super(Formatting.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public final class CompoundTagArgument<C> extends CommandArgument<C, CompoundTag
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, CompoundTag, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, CompoundTag, Builder<C>> {

Builder(final @NonNull String name) {
super(CompoundTag.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public final class EntityAnchorArgument<C> extends CommandArgument<C, EntityAnch
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, EntityAnchorArgumentType.EntityAnchor, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, EntityAnchorArgumentType.EntityAnchor, Builder<C>> {

Builder(final @NonNull String name) {
super(EntityAnchorArgumentType.EntityAnchor.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public final class FloatRangeArgument<C> extends CommandArgument<C, NumberRange.
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, NumberRange.FloatRange, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, NumberRange.FloatRange, Builder<C>> {

Builder(final @NonNull String name) {
super(NumberRange.FloatRange.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public final class IdentifierArgument<C> extends CommandArgument<C, Identifier>
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, Identifier, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, Identifier, Builder<C>> {

Builder(final @NonNull String name) {
super(Identifier.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public final class IntRangeArgument<C> extends CommandArgument<C, NumberRange.In
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, NumberRange.IntRange, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, NumberRange.IntRange, Builder<C>> {

Builder(final @NonNull String name) {
super(NumberRange.IntRange.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public final class ItemDataArgument<C> extends CommandArgument<C, ItemStackArgum
*
* @param <C> sender type
*/
public static final class Builder<C> extends TypedBuilder<C, ItemStackArgument, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, ItemStackArgument, Builder<C>> {

Builder(final @NonNull String name) {
super(ItemStackArgument.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public final class NbtPathArgument<C> extends CommandArgument<C, NbtPathArgument
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, NbtPathArgumentType.NbtPath, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, NbtPathArgumentType.NbtPath, Builder<C>> {

Builder(final @NonNull String name) {
super(NbtPathArgumentType.NbtPath.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public final class NbtTagArgument<C> extends CommandArgument<C, Tag> {
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, Tag, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, Tag, Builder<C>> {

Builder(final @NonNull String name) {
super(Tag.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public final class ParticleEffectArgument<C> extends CommandArgument<C, Particle
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, ParticleEffect, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, ParticleEffect, Builder<C>> {

Builder(final @NonNull String name) {
super(ParticleEffect.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public RegistryKey<? extends Registry<?>> getRegistry() {
* @param <V> The registry value type
* @since 1.5.0
*/
public static final class Builder<C, V> extends CommandArgument.TypedBuilder<C, V, Builder<C, V>> {
public static final class Builder<C, V> extends CommandArgument.Builder<C, V, Builder<C, V>> {

private final RegistryKey<? extends Registry<V>> registryIdent;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public final class ScoreboardCriterionArgument<C> extends CommandArgument<C, Sco
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, ScoreboardCriterion, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, ScoreboardCriterion, Builder<C>> {

Builder(final @NonNull String name) {
super(ScoreboardCriterion.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public final class ScoreboardOperationArgument<C> extends CommandArgument<C, Ope
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, Operation, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, Operation, Builder<C>> {

Builder(final @NonNull String name) {
super(Operation.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public final class StatusEffectArgument<C> extends CommandArgument<C, StatusEffe
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, StatusEffect, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, StatusEffect, Builder<C>> {

Builder(final @NonNull String name) {
super(StatusEffect.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public static final class TeamParser<C> extends SidedArgumentParser<C, String, T
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, Team, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, Team, Builder<C>> {

Builder(final @NonNull String name) {
super(Team.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public final class TimeArgument<C> extends CommandArgument<C, MinecraftTime> {
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, MinecraftTime, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, MinecraftTime, Builder<C>> {

Builder(final @NonNull String name) {
super(MinecraftTime.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public final class BlockPosArgument<C> extends CommandArgument<C, BlockCoordinat
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, BlockCoordinates, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, BlockCoordinates, Builder<C>> {

Builder(final @NonNull String name) {
super(BlockCoordinates.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public final class ColumnPosArgument<C> extends CommandArgument<C, ColumnCoordin
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, ColumnCoordinates, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, ColumnCoordinates, Builder<C>> {

Builder(final @NonNull String name) {
super(ColumnCoordinates.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public final class MessageArgument<C> extends CommandArgument<C, Message> {
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, Message, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, Message, Builder<C>> {

Builder(final @NonNull String name) {
super(Message.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public final class MultipleEntitySelectorArgument<C> extends CommandArgument<C,
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, MultipleEntitySelector, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, MultipleEntitySelector, Builder<C>> {

Builder(final @NonNull String name) {
super(MultipleEntitySelector.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public final class MultiplePlayerSelectorArgument<C> extends CommandArgument<C,
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, MultiplePlayerSelector, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, MultiplePlayerSelector, Builder<C>> {

Builder(final @NonNull String name) {
super(MultiplePlayerSelector.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public final class SingleEntitySelectorArgument<C> extends CommandArgument<C, Si
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, SingleEntitySelector, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, SingleEntitySelector, Builder<C>> {

Builder(final @NonNull String name) {
super(SingleEntitySelector.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public final class SinglePlayerSelectorArgument<C> extends CommandArgument<C, Si
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, SinglePlayerSelector, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, SinglePlayerSelector, Builder<C>> {

Builder(final @NonNull String name) {
super(SinglePlayerSelector.class, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public boolean centerIntegers() {
* @param <C> sender type
* @since 1.5.0
*/
public static final class Builder<C> extends TypedBuilder<C, Coordinates.CoordinatesXZ, Builder<C>> {
public static final class Builder<C> extends CommandArgument.Builder<C, Coordinates.CoordinatesXZ, Builder<C>> {

private boolean centerIntegers = false;

Expand Down
Loading

0 comments on commit d73e711

Please sign in to comment.