Fix merge conflicts

This commit is contained in:
Alexander Söderberg 2020-09-28 12:32:10 +02:00 committed by Alexander Söderberg
parent cd90665559
commit d85684c22a
13 changed files with 60 additions and 46 deletions

View file

@ -25,11 +25,16 @@ package cloud.commandframework;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.StaticArgument; import cloud.commandframework.arguments.StaticArgument;
import cloud.commandframework.arguments.compound.ArgumentPair;
import cloud.commandframework.arguments.compound.ArgumentTriplet;
import cloud.commandframework.execution.CommandExecutionHandler; import cloud.commandframework.execution.CommandExecutionHandler;
import cloud.commandframework.meta.CommandMeta; import cloud.commandframework.meta.CommandMeta;
import cloud.commandframework.meta.SimpleCommandMeta; import cloud.commandframework.meta.SimpleCommandMeta;
import cloud.commandframework.permission.CommandPermission; import cloud.commandframework.permission.CommandPermission;
import cloud.commandframework.permission.Permission; import cloud.commandframework.permission.Permission;
import cloud.commandframework.types.tuples.Pair;
import cloud.commandframework.types.tuples.Triplet;
import com.google.common.reflect.TypeToken;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -393,7 +398,7 @@ public class Command<C> {
* @param name Name of the argument * @param name Name of the argument
* @param names Pair containing the names of the sub-arguments * @param names Pair containing the names of the sub-arguments
* @param parserPair Pair containing the types of the sub-arguments. There must be parsers for these types registered * @param parserPair Pair containing the types of the sub-arguments. There must be parsers for these types registered
* in the {@link com.intellectualsites.commands.arguments.parser.ParserRegistry} used by the * in the {@link cloud.commandframework.arguments.parser.ParserRegistry} used by the
* {@link CommandManager} attached to this command * {@link CommandManager} attached to this command
* @param description Description of the argument * @param description Description of the argument
* @param <U> First type * @param <U> First type
@ -422,7 +427,7 @@ public class Command<C> {
* @param outputType The output type * @param outputType The output type
* @param names Pair containing the names of the sub-arguments * @param names Pair containing the names of the sub-arguments
* @param parserPair Pair containing the types of the sub-arguments. There must be parsers for these types registered * @param parserPair Pair containing the types of the sub-arguments. There must be parsers for these types registered
* in the {@link com.intellectualsites.commands.arguments.parser.ParserRegistry} used by the * in the {@link cloud.commandframework.arguments.parser.ParserRegistry} used by the
* {@link CommandManager} attached to this command * {@link CommandManager} attached to this command
* @param mapper Mapper that maps from {@link Pair} to the custom type * @param mapper Mapper that maps from {@link Pair} to the custom type
* @param description Description of the argument * @param description Description of the argument
@ -447,7 +452,7 @@ public class Command<C> {
} }
/** /**
* Create a new argument pair that maps to {@link com.intellectualsites.commands.types.tuples.Triplet} * Create a new argument pair that maps to {@link cloud.commandframework.types.tuples.Triplet}
* <p> * <p>
* For this to work, there must be a {@link CommandManager} * For this to work, there must be a {@link CommandManager}
* attached to the command builder. To guarantee this, it is recommended to get the command builder instance * attached to the command builder. To guarantee this, it is recommended to get the command builder instance
@ -456,7 +461,7 @@ public class Command<C> {
* @param name Name of the argument * @param name Name of the argument
* @param names Triplet containing the names of the sub-arguments * @param names Triplet containing the names of the sub-arguments
* @param parserTriplet Triplet containing the types of the sub-arguments. There must be parsers for these types * @param parserTriplet Triplet containing the types of the sub-arguments. There must be parsers for these types
* registered in the {@link com.intellectualsites.commands.arguments.parser.ParserRegistry} * registered in the {@link cloud.commandframework.arguments.parser.ParserRegistry}
* used by the {@link CommandManager} attached to this command * used by the {@link CommandManager} attached to this command
* @param description Description of the argument * @param description Description of the argument
* @param <U> First type * @param <U> First type
@ -486,7 +491,7 @@ public class Command<C> {
* @param outputType The output type * @param outputType The output type
* @param names Triplet containing the names of the sub-arguments * @param names Triplet containing the names of the sub-arguments
* @param parserTriplet Triplet containing the types of the sub-arguments. There must be parsers for these types * @param parserTriplet Triplet containing the types of the sub-arguments. There must be parsers for these types
* registered in the {@link com.intellectualsites.commands.arguments.parser.ParserRegistry} used by * registered in the {@link cloud.commandframework.arguments.parser.ParserRegistry} used by
* the {@link CommandManager} attached to this command * the {@link CommandManager} attached to this command
* @param mapper Mapper that maps from {@link Triplet} to the custom type * @param mapper Mapper that maps from {@link Triplet} to the custom type
* @param description Description of the argument * @param description Description of the argument

View file

@ -25,6 +25,7 @@ package cloud.commandframework;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.StaticArgument; import cloud.commandframework.arguments.StaticArgument;
import cloud.commandframework.arguments.compound.CompoundArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.context.CommandContext; import cloud.commandframework.context.CommandContext;
import cloud.commandframework.exceptions.AmbiguousNodeException; import cloud.commandframework.exceptions.AmbiguousNodeException;

View file

@ -24,6 +24,7 @@
package cloud.commandframework.arguments; package cloud.commandframework.arguments;
import cloud.commandframework.CommandTree; import cloud.commandframework.CommandTree;
import cloud.commandframework.arguments.compound.CompoundArgument;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;

View file

@ -21,14 +21,14 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE. // SOFTWARE.
// //
package com.intellectualsites.commands.arguments.compound; package cloud.commandframework.arguments.compound;
import com.google.common.reflect.TypeToken; import com.google.common.reflect.TypeToken;
import com.intellectualsites.commands.CommandManager; import cloud.commandframework.CommandManager;
import com.intellectualsites.commands.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
import com.intellectualsites.commands.arguments.parser.ParserParameters; import cloud.commandframework.arguments.parser.ParserParameters;
import com.intellectualsites.commands.arguments.parser.ParserRegistry; import cloud.commandframework.arguments.parser.ParserRegistry;
import com.intellectualsites.commands.types.tuples.Pair; import cloud.commandframework.types.tuples.Pair;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.function.Function; import java.util.function.Function;
@ -71,7 +71,7 @@ public final class ArgumentPair<C, U, V, O> extends CompoundArgument<Pair<U, V>,
* @param name Argument name * @param name Argument name
* @param names Sub-argument names * @param names Sub-argument names
* @param types Pair containing the types of the sub-arguments. There must be parsers for these types registered * @param types Pair containing the types of the sub-arguments. There must be parsers for these types registered
* in the {@link com.intellectualsites.commands.arguments.parser.ParserRegistry} used by the * in the {@link cloud.commandframework.arguments.parser.ParserRegistry} used by the
* {@link CommandManager} * {@link CommandManager}
* @param <C> Command sender type * @param <C> Command sender type
* @param <U> First parsed type * @param <U> First parsed type
@ -86,12 +86,12 @@ public final class ArgumentPair<C, U, V, O> extends CompoundArgument<Pair<U, V>,
final ParserRegistry<C> parserRegistry = manager.getParserRegistry(); final ParserRegistry<C> parserRegistry = manager.getParserRegistry();
final ArgumentParser<C, U> firstParser = parserRegistry.createParser(TypeToken.of(types.getFirst()), final ArgumentParser<C, U> firstParser = parserRegistry.createParser(TypeToken.of(types.getFirst()),
ParserParameters.empty()).orElseThrow(() -> ParserParameters.empty()).orElseThrow(() ->
new IllegalArgumentException( new IllegalArgumentException(
"Could not create parser for primary type")); "Could not create parser for primary type"));
final ArgumentParser<C, V> secondaryParser = parserRegistry.createParser(TypeToken.of(types.getSecond()), final ArgumentParser<C, V> secondaryParser = parserRegistry.createParser(TypeToken.of(types.getSecond()),
ParserParameters.empty()).orElseThrow(() -> ParserParameters.empty()).orElseThrow(() ->
new IllegalArgumentException( new IllegalArgumentException(
"Could not create parser for secondary type")); "Could not create parser for secondary type"));
return new ArgumentPairIntermediaryBuilder<>(true, name, names, Pair.of(firstParser, secondaryParser), types); return new ArgumentPairIntermediaryBuilder<>(true, name, names, Pair.of(firstParser, secondaryParser), types);
} }

View file

@ -21,14 +21,14 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE. // SOFTWARE.
// //
package com.intellectualsites.commands.arguments.compound; package cloud.commandframework.arguments.compound;
import cloud.commandframework.CommandManager;
import cloud.commandframework.arguments.parser.ArgumentParser;
import cloud.commandframework.arguments.parser.ParserParameters;
import cloud.commandframework.arguments.parser.ParserRegistry;
import cloud.commandframework.types.tuples.Triplet;
import com.google.common.reflect.TypeToken; import com.google.common.reflect.TypeToken;
import com.intellectualsites.commands.CommandManager;
import com.intellectualsites.commands.arguments.parser.ArgumentParser;
import com.intellectualsites.commands.arguments.parser.ParserParameters;
import com.intellectualsites.commands.arguments.parser.ParserRegistry;
import com.intellectualsites.commands.types.tuples.Triplet;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.function.Function; import java.util.function.Function;
@ -73,7 +73,7 @@ public final class ArgumentTriplet<C, U, V, W, O> extends CompoundArgument<Tripl
* @param name Argument name * @param name Argument name
* @param names Sub-argument names * @param names Sub-argument names
* @param types Triplet containing the types of the sub-arguments. There must be parsers for these types registered * @param types Triplet containing the types of the sub-arguments. There must be parsers for these types registered
* in the {@link com.intellectualsites.commands.arguments.parser.ParserRegistry} used by the * in the {@link cloud.commandframework.arguments.parser.ParserRegistry} used by the
* {@link CommandManager} * {@link CommandManager}
* @param <C> Command sender type * @param <C> Command sender type
* @param <U> First parsed type * @param <U> First parsed type
@ -89,17 +89,17 @@ public final class ArgumentTriplet<C, U, V, W, O> extends CompoundArgument<Tripl
@Nonnull final Triplet<Class<U>, Class<V>, Class<W>> types) { @Nonnull final Triplet<Class<U>, Class<V>, Class<W>> types) {
final ParserRegistry<C> parserRegistry = manager.getParserRegistry(); final ParserRegistry<C> parserRegistry = manager.getParserRegistry();
final ArgumentParser<C, U> firstParser = parserRegistry.createParser(TypeToken.of(types.getFirst()), final ArgumentParser<C, U> firstParser = parserRegistry.createParser(TypeToken.of(types.getFirst()),
ParserParameters.empty()).orElseThrow(() -> ParserParameters.empty()).orElseThrow(() ->
new IllegalArgumentException( new IllegalArgumentException(
"Could not create parser for primary type")); "Could not create parser for primary type"));
final ArgumentParser<C, V> secondaryParser = parserRegistry.createParser(TypeToken.of(types.getSecond()), final ArgumentParser<C, V> secondaryParser = parserRegistry.createParser(TypeToken.of(types.getSecond()),
ParserParameters.empty()).orElseThrow(() -> ParserParameters.empty()).orElseThrow(() ->
new IllegalArgumentException( new IllegalArgumentException(
"Could not create parser for secondary type")); "Could not create parser for secondary type"));
final ArgumentParser<C, W> tertiaryParser = parserRegistry.createParser(TypeToken.of(types.getThird()), final ArgumentParser<C, W> tertiaryParser = parserRegistry.createParser(TypeToken.of(types.getThird()),
ParserParameters.empty()).orElseThrow(() -> ParserParameters.empty()).orElseThrow(() ->
new IllegalArgumentException( new IllegalArgumentException(
"Could not create parser for tertiary type")); "Could not create parser for tertiary type"));
return new ArgumentTripletIntermediaryBuilder<>(true, name, names, return new ArgumentTripletIntermediaryBuilder<>(true, name, names,
Triplet.of(firstParser, secondaryParser, tertiaryParser), types); Triplet.of(firstParser, secondaryParser, tertiaryParser), types);
} }

View file

@ -21,14 +21,14 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE. // SOFTWARE.
// //
package com.intellectualsites.commands.arguments.compound; package cloud.commandframework.arguments.compound;
import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser;
import cloud.commandframework.context.CommandContext;
import cloud.commandframework.types.tuples.Tuple;
import com.google.common.reflect.TypeToken; import com.google.common.reflect.TypeToken;
import com.intellectualsites.commands.arguments.CommandArgument;
import com.intellectualsites.commands.arguments.parser.ArgumentParseResult;
import com.intellectualsites.commands.arguments.parser.ArgumentParser;
import com.intellectualsites.commands.context.CommandContext;
import com.intellectualsites.commands.types.tuples.Tuple;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.List; import java.util.List;

View file

@ -25,4 +25,4 @@
/** /**
* Argument types that consists of 2 or more sub-types * Argument types that consists of 2 or more sub-types
*/ */
package com.intellectualsites.commands.arguments.compound; package cloud.commandframework.arguments.compound;

View file

@ -1,7 +1,7 @@
// //
// MIT License // MIT License
// //
// Copyright (c) 2020 Alexander Söderberg // Copyright (c) 2020 Alexander Söderberg & Contributors
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE. // SOFTWARE.
// //
package com.intellectualsites.commands.types.tuples; package cloud.commandframework.types.tuples;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;

View file

@ -26,6 +26,7 @@ package cloud.commandframework;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.standard.IntegerArgument; import cloud.commandframework.arguments.standard.IntegerArgument;
import cloud.commandframework.meta.SimpleCommandMeta; import cloud.commandframework.meta.SimpleCommandMeta;
import cloud.commandframework.types.tuples.Pair;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View file

@ -23,9 +23,10 @@
// //
package cloud.commandframework; package cloud.commandframework;
import cloud.commandframework.arguments.standard.EnumArgument;
import cloud.commandframework.arguments.standard.IntegerArgument; import cloud.commandframework.arguments.standard.IntegerArgument;
import cloud.commandframework.arguments.standard.StringArgument; import cloud.commandframework.arguments.standard.StringArgument;
import cloud.commandframework.arguments.standard.EnumArgument; import cloud.commandframework.types.tuples.Pair;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View file

@ -23,11 +23,13 @@
// //
package cloud.commandframework; package cloud.commandframework;
import cloud.commandframework.arguments.compound.ArgumentPair;
import cloud.commandframework.arguments.standard.IntegerArgument; import cloud.commandframework.arguments.standard.IntegerArgument;
import cloud.commandframework.arguments.standard.StringArgument; import cloud.commandframework.arguments.standard.StringArgument;
import cloud.commandframework.context.CommandContext; import cloud.commandframework.context.CommandContext;
import cloud.commandframework.exceptions.NoPermissionException; import cloud.commandframework.exceptions.NoPermissionException;
import cloud.commandframework.meta.SimpleCommandMeta; import cloud.commandframework.meta.SimpleCommandMeta;
import cloud.commandframework.types.tuples.Pair;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View file

@ -23,13 +23,12 @@
// //
package cloud.commandframework.brigadier; package cloud.commandframework.brigadier;
import com.google.common.collect.Maps;
import com.google.common.reflect.TypeToken;
import cloud.commandframework.Command; import cloud.commandframework.Command;
import cloud.commandframework.CommandManager; import cloud.commandframework.CommandManager;
import cloud.commandframework.CommandTree; import cloud.commandframework.CommandTree;
import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.StaticArgument; import cloud.commandframework.arguments.StaticArgument;
import cloud.commandframework.arguments.compound.CompoundArgument;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
import cloud.commandframework.arguments.standard.BooleanArgument; import cloud.commandframework.arguments.standard.BooleanArgument;
import cloud.commandframework.arguments.standard.ByteArgument; import cloud.commandframework.arguments.standard.ByteArgument;
@ -42,6 +41,8 @@ import cloud.commandframework.context.CommandContext;
import cloud.commandframework.execution.preprocessor.CommandPreprocessingContext; import cloud.commandframework.execution.preprocessor.CommandPreprocessingContext;
import cloud.commandframework.permission.CommandPermission; import cloud.commandframework.permission.CommandPermission;
import cloud.commandframework.permission.Permission; import cloud.commandframework.permission.Permission;
import com.google.common.collect.Maps;
import com.google.common.reflect.TypeToken;
import com.mojang.brigadier.LiteralMessage; import com.mojang.brigadier.LiteralMessage;
import com.mojang.brigadier.arguments.ArgumentType; import com.mojang.brigadier.arguments.ArgumentType;
import com.mojang.brigadier.arguments.BoolArgumentType; import com.mojang.brigadier.arguments.BoolArgumentType;

View file

@ -23,13 +23,11 @@
// //
package cloud.commandframework; package cloud.commandframework;
import cloud.commandframework.execution.AsynchronousCommandExecutionCoordinator;
import cloud.commandframework.extra.confirmation.CommandConfirmationManager;
import cloud.commandframework.annotations.AnnotationParser; import cloud.commandframework.annotations.AnnotationParser;
import cloud.commandframework.annotations.Argument; import cloud.commandframework.annotations.Argument;
import cloud.commandframework.annotations.CommandDescription;
import cloud.commandframework.annotations.CommandMethod; import cloud.commandframework.annotations.CommandMethod;
import cloud.commandframework.annotations.Confirmation; import cloud.commandframework.annotations.Confirmation;
import cloud.commandframework.annotations.CommandDescription;
import cloud.commandframework.annotations.specifier.Completions; import cloud.commandframework.annotations.specifier.Completions;
import cloud.commandframework.annotations.specifier.Range; import cloud.commandframework.annotations.specifier.Range;
import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParseResult;
@ -45,9 +43,13 @@ import cloud.commandframework.bukkit.BukkitCommandMetaBuilder;
import cloud.commandframework.bukkit.CloudBukkitCapabilities; import cloud.commandframework.bukkit.CloudBukkitCapabilities;
import cloud.commandframework.bukkit.parsers.WorldArgument; import cloud.commandframework.bukkit.parsers.WorldArgument;
import cloud.commandframework.exceptions.InvalidSyntaxException; import cloud.commandframework.exceptions.InvalidSyntaxException;
import cloud.commandframework.execution.AsynchronousCommandExecutionCoordinator;
import cloud.commandframework.execution.CommandExecutionCoordinator; import cloud.commandframework.execution.CommandExecutionCoordinator;
import cloud.commandframework.extra.confirmation.CommandConfirmationManager;
import cloud.commandframework.meta.SimpleCommandMeta; import cloud.commandframework.meta.SimpleCommandMeta;
import cloud.commandframework.paper.PaperCommandManager; import cloud.commandframework.paper.PaperCommandManager;
import cloud.commandframework.types.tuples.Triplet;
import com.google.common.reflect.TypeToken;
import net.kyori.adventure.platform.bukkit.BukkitAudiences; import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;