Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-16 21:10:30 +01:00
Fix checkstyle violations
Dieser Commit ist enthalten in:
Ursprung
62be3a5da5
Commit
27dfa13b5f
@ -285,9 +285,6 @@ final class SuggestionsProvider<S> {
|
||||
* Parses the hint nodes under the given node, which is either an alias node of
|
||||
* a {@link Command} or another hint node.
|
||||
*
|
||||
* The caller must check the requirements
|
||||
* are satisfied by a given source prior to calling this method.
|
||||
*
|
||||
* <p>The reader and context are not mutated by this method.
|
||||
*
|
||||
* @param node the node to parse
|
||||
|
@ -223,7 +223,8 @@ public class VelocityCommandManager implements CommandManager {
|
||||
final String normalizedInput = VelocityCommands.normalizeInput(cmdLine, false);
|
||||
try {
|
||||
return suggestionsProvider.provideSuggestions(normalizedInput, source)
|
||||
.thenApply(suggestions -> Lists.transform(suggestions.getList(), Suggestion::getText));
|
||||
.thenApply(suggestions ->
|
||||
Lists.transform(suggestions.getList(), Suggestion::getText));
|
||||
} catch (final Throwable e) {
|
||||
// Again, plugins are naughty
|
||||
return CompletableFutures.exceptionallyCompletedFuture(
|
||||
|
@ -33,6 +33,16 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
public final class VelocityArgumentBuilder<S, T>
|
||||
extends ArgumentBuilder<S, VelocityArgumentBuilder<S, T>> {
|
||||
|
||||
/**
|
||||
* Creates a builder for creating {@link VelocityArgumentCommandNode}s with
|
||||
* the given name and type.
|
||||
*
|
||||
* @param name the name of the node
|
||||
* @param type the type of the argument to parse
|
||||
* @param <S> the type of the command source
|
||||
* @param <T> the type of the argument to parse
|
||||
* @return a builder
|
||||
*/
|
||||
public static <S, T> VelocityArgumentBuilder<S, T> velocityArgument(final String name,
|
||||
final ArgumentType<T> type) {
|
||||
Preconditions.checkNotNull(name, "name");
|
||||
@ -44,7 +54,7 @@ public final class VelocityArgumentBuilder<S, T>
|
||||
private final ArgumentType<T> type;
|
||||
private SuggestionProvider<S> suggestionsProvider = null;
|
||||
|
||||
public VelocityArgumentBuilder(final String name, final ArgumentType<T> type) {
|
||||
private VelocityArgumentBuilder(final String name, final ArgumentType<T> type) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class VelocityArgumentCommandNode<S, T> extends ArgumentCommandNode<S, St
|
||||
|
||||
private final ArgumentType<T> type;
|
||||
|
||||
public VelocityArgumentCommandNode(
|
||||
VelocityArgumentCommandNode(
|
||||
final String name, final ArgumentType<T> type, final Command<S> command,
|
||||
final Predicate<S> requirement,
|
||||
final BiPredicate<CommandContextBuilder<S>, ImmutableStringReader> contextRequirement,
|
||||
|
@ -85,7 +85,7 @@ public class CommandManagerTests extends CommandTestSuite {
|
||||
final var oldMeta = manager.createMetaBuilder("foo").build();
|
||||
manager.register(oldMeta, DummyCommand.INSTANCE); // fails on execution
|
||||
final var newMeta = manager.createMetaBuilder("foo").build();
|
||||
manager.register("foo", (RawCommand) invocation -> called.set(true));
|
||||
manager.register(newMeta, (RawCommand) invocation -> called.set(true));
|
||||
manager.execute(MockCommandSource.INSTANCE, "foo").join();
|
||||
|
||||
assertTrue(called.get());
|
||||
|
@ -93,10 +93,10 @@ public class StringArrayArgumentTypeTests {
|
||||
@Test
|
||||
void testMultipleWhitespaceCharsArePreserved() throws CommandSyntaxException {
|
||||
final StringReader reader = new StringReader(
|
||||
" This is a message that shouldn't be normalized ");
|
||||
" This is a message that shouldn't be normalized ");
|
||||
assertArrayEquals(new String[] {
|
||||
"", "This", "", "is", "a", "", "", "message", "", "that", "shouldn't", "", "", "", "be",
|
||||
"normalized", "", ""}, TYPE.parse(reader));
|
||||
"", "This", "", "is", "a", "", "", "message", "", "that", "shouldn't", "", "", "", "be",
|
||||
"normalized", "", ""}, TYPE.parse(reader));
|
||||
assertFalse(reader.canRead());
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,11 @@
|
||||
package com.velocitypowered.proxy.command.brigadier;
|
||||
|
||||
import static com.velocitypowered.proxy.command.brigadier.VelocityArgumentBuilder.velocityArgument;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.StringReader;
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren