From 46b48c8a24c915e4feb796392feac796c6dc569a Mon Sep 17 00:00:00 2001 From: DerEchtePilz Date: Sun, 1 Oct 2023 01:08:43 +0200 Subject: [PATCH] Remove deprecated methods for 10.0.0 --- .../executors/CommandArguments.java | 11 ------ .../kotlindsl/CommandAPICommandDSL.kt | 11 ------ .../commandapi/kotlindsl/CommandTreeDSL.kt | 17 --------- .../kotlindsl/CommandAPICommandDSL.kt | 11 ------ .../commandapi/kotlindsl/CommandTreeDSL.kt | 17 --------- .../commandapi/arguments/CustomArgument.java | 36 ------------------- .../arguments/MultiLiteralArgument.java | 22 ------------ .../dev/jorel/commandapi/test/TestBase.java | 6 ---- .../test/arguments/ArgumentCustomTests.java | 2 +- .../arguments/ArgumentMultiLiteralTests.java | 2 +- .../test/arguments/ArgumentTests.java | 6 ++-- .../arguments/MultiLiteralArgument.java | 22 ------------ .../arguments/MultiLiteralArgument.java | 22 ------------ 13 files changed, 5 insertions(+), 180 deletions(-) diff --git a/commandapi-core/src/main/java/dev/jorel/commandapi/executors/CommandArguments.java b/commandapi-core/src/main/java/dev/jorel/commandapi/executors/CommandArguments.java index c10f3686e3..2705d516b3 100644 --- a/commandapi-core/src/main/java/dev/jorel/commandapi/executors/CommandArguments.java +++ b/commandapi-core/src/main/java/dev/jorel/commandapi/executors/CommandArguments.java @@ -62,17 +62,6 @@ public Map rawArgsMap() { return Collections.unmodifiableMap(rawArgsMap); } - /** - * This returns the raw command string a player has entered - * - * @deprecated This method has been deprecated in favour of {@link CommandArguments#fullInput()} - * @return The raw command string a player has entered - */ - @Deprecated(since = "9.1.0", forRemoval = true) - public String getFullInput() { - return fullInput; - } - /** * @return The number of arguments for this command */ diff --git a/commandapi-kotlin/commandapi-bukkit-kotlin/src/main/kotlin/dev/jorel/commandapi/kotlindsl/CommandAPICommandDSL.kt b/commandapi-kotlin/commandapi-bukkit-kotlin/src/main/kotlin/dev/jorel/commandapi/kotlindsl/CommandAPICommandDSL.kt index 2b78065be3..3ae71e7431 100644 --- a/commandapi-kotlin/commandapi-bukkit-kotlin/src/main/kotlin/dev/jorel/commandapi/kotlindsl/CommandAPICommandDSL.kt +++ b/commandapi-kotlin/commandapi-bukkit-kotlin/src/main/kotlin/dev/jorel/commandapi/kotlindsl/CommandAPICommandDSL.kt @@ -8,8 +8,6 @@ import org.bukkit.command.CommandSender import java.util.function.Predicate inline fun commandAPICommand(name: String, command: CommandAPICommand.() -> Unit = {}) = CommandAPICommand(name).apply(command).register() -@Deprecated("This method has been deprecated since version 9.1.0 as it is not needed anymore. See the documentation for more information", ReplaceWith(""), DeprecationLevel.WARNING) -inline fun commandAPICommand(name: String, predicate: Predicate, command: CommandAPICommand.() -> Unit = {}) = CommandAPICommand(name).withRequirement(predicate).apply(command).register() inline fun CommandAPICommand.argument(base: Argument<*>, block: Argument<*>.() -> Unit = {}): CommandAPICommand = withArguments(base.apply(block)) inline fun CommandAPICommand.arguments(vararg arguments: Argument<*>): CommandAPICommand = withArguments(*arguments) @@ -111,16 +109,7 @@ inline fun CommandAPICommand.nbtCompoundArgument(nodeName: String inline fun CommandAPICommand.literalArgument(literal: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandAPICommand = withArguments(LiteralArgument.of(literal, literal).setOptional(optional).apply(block)) inline fun CommandAPICommand.literalArgument(nodeName: String, literal: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandAPICommand = withArguments(LiteralArgument.of(nodeName, literal).setOptional(optional).apply(block)) -@Deprecated("This version has been deprecated since version 9.0.2", ReplaceWith("multiLiteralArgument(nodeName, listOf(literals))", "dev.jorel.commandapi.kotlindsl.*"), DeprecationLevel.WARNING) -inline fun CommandAPICommand.multiLiteralArgument(vararg literals: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandAPICommand = withArguments(MultiLiteralArgument(literals).setOptional(optional).apply(block)) -@Deprecated("This method has been deprecated since version 9.1.0", ReplaceWith("multiLiteralArgument(nodeName, literals)", "dev.jorel.commandapi.kotlindsl.*"), DeprecationLevel.WARNING) -inline fun CommandAPICommand.multiLiteralArgument(nodeName: String, literals: List, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandAPICommand = withArguments(MultiLiteralArgument(nodeName, literals).setOptional(optional).apply(block)) - inline fun CommandAPICommand.multiLiteralArgument(nodeName: String, vararg literals: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandAPICommand = withArguments(MultiLiteralArgument(nodeName, *literals).setOptional(optional).apply(block)) // Function arguments inline fun CommandAPICommand.functionArgument(nodeName: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandAPICommand = withArguments(FunctionArgument(nodeName).setOptional(optional).apply(block)) - -// Requirements -@Deprecated("This method has been deprecated since version 9.1.0 as it is not needed anymore. See the documentation for more information", ReplaceWith(""), DeprecationLevel.WARNING) -inline fun CommandAPICommand.requirement(base: Argument<*>, predicate: Predicate, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandAPICommand = withArguments(base.setOptional(optional).withRequirement(predicate).apply(block)) diff --git a/commandapi-kotlin/commandapi-bukkit-kotlin/src/main/kotlin/dev/jorel/commandapi/kotlindsl/CommandTreeDSL.kt b/commandapi-kotlin/commandapi-bukkit-kotlin/src/main/kotlin/dev/jorel/commandapi/kotlindsl/CommandTreeDSL.kt index 55472e2e92..5c4086601a 100644 --- a/commandapi-kotlin/commandapi-bukkit-kotlin/src/main/kotlin/dev/jorel/commandapi/kotlindsl/CommandTreeDSL.kt +++ b/commandapi-kotlin/commandapi-bukkit-kotlin/src/main/kotlin/dev/jorel/commandapi/kotlindsl/CommandTreeDSL.kt @@ -6,8 +6,6 @@ import org.bukkit.command.CommandSender import java.util.function.Predicate inline fun commandTree(name: String, tree: CommandTree.() -> Unit = {}) = CommandTree(name).apply(tree).register() -@Deprecated("This method has been deprecated since version 9.1.0 as it is not needed anymore. See the documentation for more information", ReplaceWith(""), DeprecationLevel.WARNING) -inline fun commandTree(name: String, predicate: Predicate, tree: CommandTree.() -> Unit = {}) = CommandTree(name).withRequirement(predicate).apply(tree).register() // CommandTree start inline fun CommandTree.argument(base: Argument<*>, block: Argument<*>.() -> Unit = {}): CommandTree = then(base.apply(block)) @@ -104,11 +102,6 @@ inline fun CommandTree.nbtCompoundArgument(nodeName: String, opti inline fun CommandTree.literalArgument(literal: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandTree= then(LiteralArgument.of(literal, literal).setOptional(optional).apply(block)) inline fun CommandTree.literalArgument(nodeName: String, literal: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandTree= then(LiteralArgument.of(nodeName, literal).setOptional(optional).apply(block)) -@Deprecated("This version has been deprecated since version 9.0.2", ReplaceWith("multiLiteralArgument(nodeName, listOf(literals))", "dev.jorel.commandapi.kotlindsl.*"), DeprecationLevel.WARNING) -inline fun CommandTree.multiLiteralArgument(vararg literals: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandTree= then(MultiLiteralArgument(literals).setOptional(optional).apply(block)) -@Deprecated("This method has been deprecated since version 9.1.0", ReplaceWith("multiLiteralArgument(nodeName, literals)", "dev.jorel.commandapi.kotlindsl.*"), DeprecationLevel.WARNING) -inline fun CommandTree.multiLiteralArgument(nodeName: String, literals: List, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandTree= then(MultiLiteralArgument(nodeName, literals).setOptional(optional).apply(block)) - inline fun CommandTree.multiLiteralArgument(nodeName: String, vararg literals: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandTree= then(MultiLiteralArgument(nodeName, *literals).setOptional(optional).apply(block)) // Function arguments @@ -209,17 +202,7 @@ inline fun Argument<*>.nbtCompoundArgument(nodeName: String, opti inline fun Argument<*>.literalArgument(literal: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): Argument<*> = then(LiteralArgument.of(literal, literal).setOptional(optional).apply(block)) inline fun Argument<*>.literalArgument(nodeName: String, literal: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): Argument<*> = then(LiteralArgument.of(nodeName, literal).setOptional(optional).apply(block)) -@Deprecated("This version has been deprecated since version 9.0.2", ReplaceWith("multiLiteralArgument(nodeName, listOf(literals))", "dev.jorel.commandapi.kotlindsl.*"), DeprecationLevel.WARNING) -inline fun Argument<*>.multiLiteralArgument(vararg literals: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): Argument<*> = then(MultiLiteralArgument(literals).setOptional(optional).apply(block)) -@Deprecated("This method has been deprecated since version 9.1.0", ReplaceWith("multiLiteralArgument(nodeName, literals)", "dev.jorel.commandapi.kotlindsl.*"), DeprecationLevel.WARNING) -inline fun Argument<*>.multiLiteralArgument(nodeName: String, literals: List, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): Argument<*> = then(MultiLiteralArgument(nodeName, literals).setOptional(optional).apply(block)) - inline fun Argument<*>.multiLiteralArgument(nodeName: String, vararg literals: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): Argument<*> = then(MultiLiteralArgument(nodeName, *literals).setOptional(optional).apply(block)) // Function arguments inline fun Argument<*>.functionArgument(nodeName: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): Argument<*> = then(FunctionArgument(nodeName).setOptional(optional).apply(block)) - -@Deprecated("This method has been deprecated since version 9.1.0 as it is not needed anymore. See the documentation for more information", ReplaceWith(""), DeprecationLevel.WARNING) -inline fun CommandTree.requirement(base: Argument<*>, predicate: Predicate, block: Argument<*>.() -> Unit = {}): CommandTree = then(base.withRequirement(predicate).apply(block)) -@Deprecated("This method has been deprecated since version 9.1.0 as it is not needed anymore. See the documentation for more information", ReplaceWith(""), DeprecationLevel.WARNING) -inline fun Argument<*>.requirement(base: Argument<*>, predicate: Predicate, block: Argument<*>.() -> Unit = {}): Argument<*> = then(base.withRequirement(predicate).apply(block)) diff --git a/commandapi-kotlin/commandapi-velocity-kotlin/src/main/kotlin/dev/jorel/commandapi/kotlindsl/CommandAPICommandDSL.kt b/commandapi-kotlin/commandapi-velocity-kotlin/src/main/kotlin/dev/jorel/commandapi/kotlindsl/CommandAPICommandDSL.kt index dd40b189b5..ef088a8c7c 100644 --- a/commandapi-kotlin/commandapi-velocity-kotlin/src/main/kotlin/dev/jorel/commandapi/kotlindsl/CommandAPICommandDSL.kt +++ b/commandapi-kotlin/commandapi-velocity-kotlin/src/main/kotlin/dev/jorel/commandapi/kotlindsl/CommandAPICommandDSL.kt @@ -8,8 +8,6 @@ import dev.jorel.commandapi.arguments.* import java.util.function.Predicate inline fun commandAPICommand(name: String, command: CommandAPICommand.() -> Unit = {}) = CommandAPICommand(name).apply(command).register() -@Deprecated("This method has been deprecated since version 9.1.0 as it is not needed anymore. See the documentation for more information", ReplaceWith(""), DeprecationLevel.WARNING) -inline fun commandAPICommand(name: String, predicate: Predicate, command: CommandAPICommand.() -> Unit = {}) = CommandAPICommand(name).withRequirement(predicate).apply(command).register() inline fun CommandAPICommand.argument(base: Argument<*>, block: Argument<*>.() -> Unit = {}): CommandAPICommand = withArguments(base.apply(block)) inline fun CommandAPICommand.arguments(vararg arguments: Argument<*>): CommandAPICommand = withArguments(*arguments) @@ -45,13 +43,4 @@ inline fun CommandAPICommand.greedyStringArgument(nodeName: String, optional: Bo inline fun CommandAPICommand.literalArgument(literal: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandAPICommand = withArguments(LiteralArgument.of(literal, literal).setOptional(optional).apply(block)) inline fun CommandAPICommand.literalArgument(nodeName: String, literal: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandAPICommand = withArguments(LiteralArgument.of(nodeName, literal).setOptional(optional).apply(block)) -@Deprecated("This version has been deprecated since version 9.0.2", ReplaceWith("multiLiteralArgument(nodeName, listOf(literals))", "dev.jorel.commandapi.kotlindsl.*"), DeprecationLevel.WARNING) -inline fun CommandAPICommand.multiLiteralArgument(vararg literals: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandAPICommand = withArguments(MultiLiteralArgument(literals).setOptional(optional).apply(block)) -@Deprecated("This method has been deprecated since version 9.1.0", ReplaceWith("multiLiteralArgument(nodeName, literals)", "dev.jorel.commandapi.kotlindsl.*"), DeprecationLevel.WARNING) -inline fun CommandAPICommand.multiLiteralArgument(nodeName: String, literals: List, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandAPICommand = withArguments(MultiLiteralArgument(nodeName, literals).setOptional(optional).apply(block)) - inline fun CommandAPICommand.multiLiteralArgument(nodeName: String, vararg literals: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandAPICommand = withArguments(MultiLiteralArgument(nodeName, *literals).setOptional(optional).apply(block)) - -// Requirements -@Deprecated("This method has been deprecated since version 9.1.0 as it is not needed anymore. See the documentation for more information", ReplaceWith(""), DeprecationLevel.WARNING) -inline fun CommandAPICommand.requirement(base: Argument<*>, predicate: Predicate, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandAPICommand = withArguments(base.setOptional(optional).withRequirement(predicate).apply(block)) diff --git a/commandapi-kotlin/commandapi-velocity-kotlin/src/main/kotlin/dev/jorel/commandapi/kotlindsl/CommandTreeDSL.kt b/commandapi-kotlin/commandapi-velocity-kotlin/src/main/kotlin/dev/jorel/commandapi/kotlindsl/CommandTreeDSL.kt index 4b971f307b..f31e3402e2 100644 --- a/commandapi-kotlin/commandapi-velocity-kotlin/src/main/kotlin/dev/jorel/commandapi/kotlindsl/CommandTreeDSL.kt +++ b/commandapi-kotlin/commandapi-velocity-kotlin/src/main/kotlin/dev/jorel/commandapi/kotlindsl/CommandTreeDSL.kt @@ -6,8 +6,6 @@ import dev.jorel.commandapi.arguments.* import java.util.function.Predicate inline fun commandTree(name: String, tree: CommandTree.() -> Unit = {}) = CommandTree(name).apply(tree).register() -@Deprecated("This method has been deprecated since version 9.1.0 as it is not needed anymore. See the documentation for more information", ReplaceWith(""), DeprecationLevel.WARNING) -inline fun commandTree(name: String, predicate: Predicate, tree: CommandTree.() -> Unit = {}) = CommandTree(name).withRequirement(predicate).apply(tree).register() // CommandTree start inline fun CommandTree.argument(base: Argument<*>, block: Argument<*>.() -> Unit = {}): CommandTree = then(base.apply(block)) @@ -38,11 +36,6 @@ inline fun CommandTree.greedyStringArgument(nodeName: String, optional: Boolean inline fun CommandTree.literalArgument(literal: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandTree= then(LiteralArgument.of(literal, literal).setOptional(optional).apply(block)) inline fun CommandTree.literalArgument(nodeName: String, literal: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandTree= then(LiteralArgument.of(nodeName, literal).setOptional(optional).apply(block)) -@Deprecated("This version has been deprecated since version 9.0.2", ReplaceWith("multiLiteralArgument(nodeName, listOf(literals))", "dev.jorel.commandapi.kotlindsl.*"), DeprecationLevel.WARNING) -inline fun CommandTree.multiLiteralArgument(vararg literals: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandTree= then(MultiLiteralArgument(literals).setOptional(optional).apply(block)) -@Deprecated("This method has been deprecated since version 9.1.0", ReplaceWith("multiLiteralArgument(nodeName, literals)", "dev.jorel.commandapi.kotlindsl.*"), DeprecationLevel.WARNING) -inline fun CommandTree.multiLiteralArgument(nodeName: String, literals: List, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandTree= then(MultiLiteralArgument(nodeName, literals).setOptional(optional).apply(block)) - inline fun CommandTree.multiLiteralArgument(nodeName: String, vararg literals: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): CommandTree= then(MultiLiteralArgument(nodeName, *literals).setOptional(optional).apply(block)) @@ -75,14 +68,4 @@ inline fun Argument<*>.greedyStringArgument(nodeName: String, optional: Boolean inline fun Argument<*>.literalArgument(literal: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): Argument<*> = then(LiteralArgument.of(literal, literal).setOptional(optional).apply(block)) inline fun Argument<*>.literalArgument(nodeName: String, literal: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): Argument<*> = then(LiteralArgument.of(nodeName, literal).setOptional(optional).apply(block)) -@Deprecated("This version has been deprecated since version 9.0.2", ReplaceWith("multiLiteralArgument(nodeName, listOf(literals))", "dev.jorel.commandapi.kotlindsl.*"), DeprecationLevel.WARNING) -inline fun Argument<*>.multiLiteralArgument(vararg literals: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): Argument<*> = then(MultiLiteralArgument(literals).setOptional(optional).apply(block)) -@Deprecated("This method has been deprecated since version 9.1.0", ReplaceWith("multiLiteralArgument(nodeName, literals)", "dev.jorel.commandapi.kotlindsl.*"), DeprecationLevel.WARNING) -inline fun Argument<*>.multiLiteralArgument(nodeName: String, literals: List, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): Argument<*> = then(MultiLiteralArgument(nodeName, literals).setOptional(optional).apply(block)) - inline fun Argument<*>.multiLiteralArgument(nodeName: String, vararg literals: String, optional: Boolean = false, block: Argument<*>.() -> Unit = {}): Argument<*> = then(MultiLiteralArgument(nodeName, *literals).setOptional(optional).apply(block)) - -@Deprecated("This method has been deprecated since version 9.1.0 as it is not needed anymore. See the documentation for more information", ReplaceWith(""), DeprecationLevel.WARNING) -inline fun CommandTree.requirement(base: Argument<*>, predicate: Predicate, block: Argument<*>.() -> Unit = {}): CommandTree = then(base.withRequirement(predicate).apply(block)) -@Deprecated("This method has been deprecated since version 9.1.0 as it is not needed anymore. See the documentation for more information", ReplaceWith(""), DeprecationLevel.WARNING) -inline fun Argument<*>.requirement(base: Argument<*>, predicate: Predicate, block: Argument<*>.() -> Unit = {}): Argument<*> = then(base.withRequirement(predicate).apply(block)) diff --git a/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-core/src/main/java/dev/jorel/commandapi/arguments/CustomArgument.java b/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-core/src/main/java/dev/jorel/commandapi/arguments/CustomArgument.java index 2f1756ac68..211228a38a 100644 --- a/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-core/src/main/java/dev/jorel/commandapi/arguments/CustomArgument.java +++ b/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-core/src/main/java/dev/jorel/commandapi/arguments/CustomArgument.java @@ -230,42 +230,6 @@ private CustomArgumentException() { } - /** - * Constructs a CustomArgumentException with a given error message - * - * @param errorMessage the error message to display to the user when this - * exception is thrown - * @deprecated Use {@link CustomArgumentException#fromBaseComponents(BaseComponent...)} instead - */ - @Deprecated(since = "9.0.1", forRemoval = true) - public CustomArgumentException(BaseComponent[] errorMessage) { - this.errorBaseComponent = errorMessage; - } - - /** - * Constructs a CustomArgumentException with a given error message - * - * @param errorMessage the error message to display to the user when this - * exception is thrown - * @deprecated Use {@link CustomArgumentException#fromString(String)} instead - */ - @Deprecated(since = "9.0.1", forRemoval = true) - public CustomArgumentException(String errorMessage) { - this.errorMessage = errorMessage; - } - - /** - * Constructs a CustomArgumentException with a given error message - * - * @param errorMessage the error message to display to the user when this - * exception is thrown - * @deprecated Use {@link CustomArgumentException#fromMessageBuilder(MessageBuilder)} instead - */ - @Deprecated(since = "9.0.1", forRemoval = true) - public CustomArgumentException(MessageBuilder errorMessage) { - this.errorMessageBuilder = errorMessage; - } - /** * Constructs a CustomArgumentException with a given error message * diff --git a/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-core/src/main/java/dev/jorel/commandapi/arguments/MultiLiteralArgument.java b/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-core/src/main/java/dev/jorel/commandapi/arguments/MultiLiteralArgument.java index eeea5b5ec1..376540d5dc 100644 --- a/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-core/src/main/java/dev/jorel/commandapi/arguments/MultiLiteralArgument.java +++ b/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-core/src/main/java/dev/jorel/commandapi/arguments/MultiLiteralArgument.java @@ -53,28 +53,6 @@ public MultiLiteralArgument(String nodeName, String... literals) { this.literals = literals; } - /** - * A multiliteral argument. Takes in string literals which cannot be modified - * @param literals the literals that this argument represents - * @deprecated Use {@link MultiLiteralArgument#MultiLiteralArgument(String, String...)} instead - */ - @Deprecated(since = "9.0.2", forRemoval = true) - public MultiLiteralArgument(final String[] literals) { - this(null, literals); - } - - /** - * A multiliteral argument. Takes in string literals which cannot be modified - * - * @param nodeName the node name for this argument - * @param literals the literals that this argument represents - * @deprecated Use {@link MultiLiteralArgument#MultiLiteralArgument(String, String...)} instead - */ - @Deprecated(since = "9.1.0", forRemoval = true) - public MultiLiteralArgument(String nodeName, final List literals) { - this(nodeName, literals.toArray(new String[0])); - } - @Override public Class getPrimitiveType() { return String.class; diff --git a/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-test/commandapi-bukkit-test-tests/src/test/java/dev/jorel/commandapi/test/TestBase.java b/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-test/commandapi-bukkit-test-tests/src/test/java/dev/jorel/commandapi/test/TestBase.java index 1a83f564f8..8bfa6c2d34 100644 --- a/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-test/commandapi-bukkit-test-tests/src/test/java/dev/jorel/commandapi/test/TestBase.java +++ b/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-test/commandapi-bukkit-test-tests/src/test/java/dev/jorel/commandapi/test/TestBase.java @@ -110,12 +110,6 @@ public void assertStoresResult(CommandSender sender, String command, Mut assertDoesNotThrow(queue::get, "Expected to find <" + expected + "> in queue, but nothing was present") ); } - - @Deprecated - public void assertInvalidSyntax(CommandSender sender, String command) { - // XXX: Bogus code, do not use. Use assertCommandFailsWith instead. - assertThrows(CommandSyntaxException.class, () -> assertTrue(server.dispatchThrowableCommand(sender, command))); - } public void assertCommandFailsWith(CommandSender sender, String command, String message) { CommandSyntaxException exception = assertThrows(CommandSyntaxException.class, () -> server.dispatchThrowableCommand(sender, command)); diff --git a/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-test/commandapi-bukkit-test-tests/src/test/java/dev/jorel/commandapi/test/arguments/ArgumentCustomTests.java b/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-test/commandapi-bukkit-test-tests/src/test/java/dev/jorel/commandapi/test/arguments/ArgumentCustomTests.java index b74b7e7e11..bf8eb49a33 100644 --- a/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-test/commandapi-bukkit-test-tests/src/test/java/dev/jorel/commandapi/test/arguments/ArgumentCustomTests.java +++ b/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-test/commandapi-bukkit-test-tests/src/test/java/dev/jorel/commandapi/test/arguments/ArgumentCustomTests.java @@ -155,7 +155,7 @@ void instantiationTestWithLiteralCustomArgument() { }); // MultiLiteralArgument - MultiLiteralArgument multiLiteralArgument = new MultiLiteralArgument("node", List.of("hello", "world")); + MultiLiteralArgument multiLiteralArgument = new MultiLiteralArgument("node", "hello", "world"); assertThrows(IllegalArgumentException.class, () -> { new CustomArgument<>(multiLiteralArgument, info -> 1); diff --git a/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-test/commandapi-bukkit-test-tests/src/test/java/dev/jorel/commandapi/test/arguments/ArgumentMultiLiteralTests.java b/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-test/commandapi-bukkit-test-tests/src/test/java/dev/jorel/commandapi/test/arguments/ArgumentMultiLiteralTests.java index 8688324c94..d9df9768dc 100644 --- a/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-test/commandapi-bukkit-test-tests/src/test/java/dev/jorel/commandapi/test/arguments/ArgumentMultiLiteralTests.java +++ b/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-test/commandapi-bukkit-test-tests/src/test/java/dev/jorel/commandapi/test/arguments/ArgumentMultiLiteralTests.java @@ -166,7 +166,7 @@ public void executionTestWithArrayConstructor() { Mut results = Mut.of(); new CommandAPICommand("test") - .withArguments(new MultiLiteralArgument(new String[]{"lit1", "lit2", "lit3"})) + .withArguments(new MultiLiteralArgument("literals", "lit1", "lit2", "lit3")) .executesPlayer(info -> { results.set((String) info.args().get(0)); }) diff --git a/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-test/commandapi-bukkit-test-tests/src/test/java/dev/jorel/commandapi/test/arguments/ArgumentTests.java b/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-test/commandapi-bukkit-test-tests/src/test/java/dev/jorel/commandapi/test/arguments/ArgumentTests.java index c476b14705..c59f1de123 100644 --- a/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-test/commandapi-bukkit-test-tests/src/test/java/dev/jorel/commandapi/test/arguments/ArgumentTests.java +++ b/commandapi-platforms/commandapi-bukkit/commandapi-bukkit-test/commandapi-bukkit-test-tests/src/test/java/dev/jorel/commandapi/test/arguments/ArgumentTests.java @@ -117,8 +117,8 @@ void executionTestWithStringArgument() { assertEquals("success Hello_world", player.nextMessage()); // Negative tests from the documentation - assertInvalidSyntax(player, "test hello@email.com"); - assertInvalidSyntax(player, "test yesn't"); + assertCommandFailsWith(player, "test hello@email.com", "Expected whitespace to end one argument, but found trailing data at position 10: test hello<--[HERE]"); + assertCommandFailsWith(player, "test yesn't", "Expected whitespace to end one argument, but found trailing data at position 9: test yesn<--[HERE]"); } @Test @@ -358,7 +358,7 @@ void executionTestWithPlayerArgument() { server.dispatchCommand(player, "test APlayer"); assertEquals(player, results.get()); - assertInvalidSyntax(player, "test BPlayer"); + assertCommandFailsWith(player, "test BPlayer", "That player does not exist"); assertNoMoreResults(results); } diff --git a/commandapi-platforms/commandapi-sponge/commandapi-sponge-core/src/main/java/dev/jorel/commandapi/arguments/MultiLiteralArgument.java b/commandapi-platforms/commandapi-sponge/commandapi-sponge-core/src/main/java/dev/jorel/commandapi/arguments/MultiLiteralArgument.java index 2ccf0df5b4..3de8ffeff9 100644 --- a/commandapi-platforms/commandapi-sponge/commandapi-sponge-core/src/main/java/dev/jorel/commandapi/arguments/MultiLiteralArgument.java +++ b/commandapi-platforms/commandapi-sponge/commandapi-sponge-core/src/main/java/dev/jorel/commandapi/arguments/MultiLiteralArgument.java @@ -51,28 +51,6 @@ public MultiLiteralArgument(String nodeName, String... literals) { this.literals = literals; } - /** - * A multiliteral argument. Takes in string literals which cannot be modified - * @param literals the literals that this argument represents - * @deprecated Use {@link MultiLiteralArgument#MultiLiteralArgument(String, String...)} instead - */ - @Deprecated(since = "9.0.2", forRemoval = true) - public MultiLiteralArgument(final List literals) { - this(null, literals); - } - - /** - * A multiliteral argument. Takes in string literals which cannot be modified - * - * @param nodeName the node name for this argument - * @param literals the literals that this argument represents - * @deprecated Use {@link MultiLiteralArgument#MultiLiteralArgument(String, String...)} instead - */ - @Deprecated(since = "9.1.0", forRemoval = true) - public MultiLiteralArgument(String nodeName, final List literals) { - this(nodeName, literals.toArray(new String[0])); - } - @Override public Class getPrimitiveType() { return String.class; diff --git a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/arguments/MultiLiteralArgument.java b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/arguments/MultiLiteralArgument.java index ee7fca3572..3de8ffeff9 100644 --- a/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/arguments/MultiLiteralArgument.java +++ b/commandapi-platforms/commandapi-velocity/commandapi-velocity-core/src/main/java/dev/jorel/commandapi/arguments/MultiLiteralArgument.java @@ -51,28 +51,6 @@ public MultiLiteralArgument(String nodeName, String... literals) { this.literals = literals; } - /** - * A multiliteral argument. Takes in string literals which cannot be modified - * @param literals the literals that this argument represents - * @deprecated Use {@link MultiLiteralArgument#MultiLiteralArgument(String, String...)} instead - */ - @Deprecated(since = "9.0.2", forRemoval = true) - public MultiLiteralArgument(final String[] literals) { - this(null, literals); - } - - /** - * A multiliteral argument. Takes in string literals which cannot be modified - * - * @param nodeName the node name for this argument - * @param literals the literals that this argument represents - * @deprecated Use {@link MultiLiteralArgument#MultiLiteralArgument(String, String...)} instead - */ - @Deprecated(since = "9.1.0", forRemoval = true) - public MultiLiteralArgument(String nodeName, final List literals) { - this(nodeName, literals.toArray(new String[0])); - } - @Override public Class getPrimitiveType() { return String.class;